Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improving the default selected item style for WPF tree views

Just about every tree view and list item in Windows has an attractive light-blue with border selected item effect:

Pretty selected item effect

But when I create a simple tree view using WPF the default effect is far less pleasing:

Ugly selected item effect

What do I need to do to change my list view item selected effect to be consist with the effect in the top screenshot? Is there some standard / system way of creating this effect or do I need to create it myself using borders, fill effects (and of course the colour picker in MSPaint)

This is the xaml that I am currently using:

<TreeView Name="myTreeView" Margin="1">
    <TreeView.Resources>
        <HierarchicalDataTemplate DataType="{x:Type local:NodeType}" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Source="{Binding Icon}" />
                <TextBlock Text="{Binding DisplayName}" Margin="5, 0" />
            </StackPanel>
        </HierarchicalDataTemplate>
    </TreeView.Resources>
</TreeView>
like image 902
Justin Avatar asked Dec 08 '25 09:12

Justin


1 Answers

This thread might help finding an answer

like image 78
Gimno Avatar answered Dec 10 '25 00:12

Gimno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!