Treeview in expander
-
Hello, I have a treeview in expander in my wpf project.. I am using hierarchical datatemplate (which have arrow image and textblock) for treeview databinding. I am using style triggers for changing selected node's fonts to bold.. Now upto this all things working fine, but after selecting particular node(either child or parent) when i collapsed my expander control and expand it again, background for textblock will be gray.. Any idea??
-
Hello, I have a treeview in expander in my wpf project.. I am using hierarchical datatemplate (which have arrow image and textblock) for treeview databinding. I am using style triggers for changing selected node's fonts to bold.. Now upto this all things working fine, but after selecting particular node(either child or parent) when i collapsed my expander control and expand it again, background for textblock will be gray.. Any idea??
Last selected Item of treeview control will display the gray color, on expand of expander for the reason it represent disabled selection. Select an item in treeviewcontrol, and then click outside the preview of treeviewcontrol to trigger lost focus of treeviewcontrol, the selected item will be gray. <Style x:Key="TreeViewItemItemTemplateStyle" TargetType="{x:Type TreeViewItem}"> <Style.Resources> <!-- Background of selected item when focussed --> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue" /> <!-- Background of selected item when not focussed --> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray" /> </Style.Resources> </Style> you can override the gray color by applying the color you want for not focussed style.