Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / desktop / WPF

Multi selection TreeView in WPF... the easy way.

2.67/5 (3 votes)
30 Jan 2010CPOL 28.2K  
Want to use multi selection in WPF TreeView ? <Setter Property=BorderBrush...
Want to use multi selection in WPF TreeView ?

XML
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="BorderThickness" Value="1"></Setter>
<Style.Triggers>
<Trigger  Property="c:TreeViewExtensions.IsSelected"  Value="True" >
 <Setter Property="BorderBrush" Value="Gray"></Setter>
</Trigger>
</Style.Triggers>
</Style>

...

<TreeView c:TreeViewExtensions.EnableMultiSelect="true"
c:TreeViewExtensions.SelectedItems="{Binding SelectedItems}"
ItemsSource="{Binding Items}"
... />



Code and sample on my blog[^].

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)