Copy for Treeview Item in wpf

How to enable copy in my treeviewitem so that i can copy the text in treeview selecteditem and paste it somewhere else. I can't find such property in treeview in wpf.

here is my code

    <TreeViewItem Header="Intution Studio" ItemsSource="{Binding Main}">
            <Style TargetType="{x:Type TreeViewItem}">
                <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                <Setter Property="FontWeight" Value="Normal" />
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="FontWeight" Value="Bold" />
            <ContextMenu ItemsSource="{Binding}">
                <MenuItem Command="Copy">
                    <!-- (can't enable copy option) -->
                        <Image Source="Images\copy.png" Width="20" Height="20"/>
            <HierarchicalDataTemplate  DataType="{x:Type TextBlock}">
                <!-- ... -->


Edit: Sorry WPF does not support that.

You should solve this by cloning the underlying data in your model. If you don't have MVVM or must per se clone the visual control, the only reasonable solution seems serializing it to a xaml and then reconstructing it from that.

Need Your Help

shake screen unlock


I am working on an app which will lock the screen on shake it consist of a main activity having two buttons to start and stop the app.

ASP.NET Web API Self-Host both HTTPS and HTTP in single service?


I have a public self-hosted ASP.NET Web API service that exposes two controllers. One of them I would like to have accessible only via HTTPS, and the other I don't. Can this be done within a single

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.