3

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>
Justin
  • 84,773
  • 49
  • 224
  • 367
  • possible duplicate of [WPF TreeView: How to style selected items with rounded corners like in Explorer](http://stackoverflow.com/questions/5047576/wpf-treeview-how-to-style-selected-items-with-rounded-corners-like-in-explorer) – Justin Mar 19 '11 at 15:02

1 Answers1

2

This thread might help finding an answer

Community
  • 1
  • 1
Gimno
  • 6,506
  • 3
  • 39
  • 39
  • Thanks, thats pretty much exactly what I am looking for - I was sure someone else would have come across this before but couldn't find a thread. – Justin Mar 19 '11 at 15:01