Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to Change TreeViewItem color when cut

$
0
0

Hallo,

I have the below treeview. I use a hierarchical datatemplate. I am add commands like cope and paste for the treeviewitems. Im trying to change the color

of the treeviewitem's background when it i cut it and its not pasted yet. I cant find the way. Can someone shed some light on this?

<UserControl x:Class="SemcaUI.TreeViewControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:l="clr-namespace:myProject"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"><UserControl.Resources><HierarchicalDataTemplate DataType="{x:Type l:ColFirstCollection}" ItemsSource="{Binding Path=SecondCollection}"><DockPanel Height="15" IsEnabled="False"><Image Source="/MainWindowUI/Images/Cut.png"/><TextBlock Text="{Binding Path=FCName}"/></DockPanel></HierarchicalDataTemplate><HierarchicalDataTemplate DataType="{x:Type l:ColSecondCollection}" ItemsSource="{Binding Path=SecondCollection}"><DockPanel Height="15" IsEnabled="False"><Image Source="/MainWindowUI/Images/Cut.png"/><TextBlock Text="{Binding Path=SCName}"/></DockPanel></HierarchicalDataTemplate></UserControl.Resources><Grid><TreeView  x:Name="myTreeView" AllowDrop="True" TreeViewItem.Selected="myTreeView_Selected" ><TreeView.ItemContainerStyle><Style TargetType="{x:Type TreeViewItem}"><EventSetter Event="TreeViewItem.MouseRightButtonUp" Handler="myTreeView_MouseRightButtonUp"/><EventSetter Event="TreeViewItem.MouseMove" Handler="treeViewItem_MouseMove"/></Style></TreeView.ItemContainerStyle></TreeView></Grid></UserControl>


Jc


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>