Hello.

There is a TreeView . I select in it TreeViewitem . TreeViewItem highlighted in green. And the text color becomes white. How to change the text color to another and how to make the color of the TreeViewItem also change when you hover?

 treeView.Resources.Clear(); treeView.Resources.Add(SystemColors.ControlBrushKey, new SolidColorBrush(Colors.Lime)); treeView.Resources.Add(SystemColors.HighlightBrushKey, new SolidColorBrush(Colors.Lime)); treeView.Resources.Add(SystemColors.HighlightBrush, new SolidColorBrush(Colors.Lime)); treeView.Resources.Add(SystemColors.HighlightColor, new SolidColorBrush(Colors.Lime)); 

    1 answer 1

    At first glance, you are doing everything right. Try to override the system backlight colors in XAML

     <TreeView.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Green" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Blue" /> </TreeView.Resources>