/FileExplorer

TreeViewer with multiple-item-selection and accessible SelectedItems property

Primary LanguageC#

FileExplorer

TreeViewer with multiple-item-selection and accessible SelectedItems property WPF TreeView with Multiple Selection

With the WPF TreeView it is not possible to select multiple items. But it can be easily extended. Therefore an Attached Property can be used. Then we can add the Attached Property to the TreeView. With IsMultipleSelection="True" we activate the multiple selection in the TreeView. With the property SelectedItems we can bind the multiple selected items to a property of the DataContext. We can define the style of a multiple selected TreeViewItem within a Style Trigger.

alt text