0
votes

I need to set the IsSelected item to currently expanded node in the treeview. How this could be done?

My problem is, i am programatically setting the IsSelected property of some nodes in the tree. Whenever i set this, though in the UI it shows the current selected node, the the IsSelected property of the tree which actually returns the selectedItem is perhaps bound to the root node rather than the current selected node. Any suggestion on this???

1

1 Answers

0
votes

I would like to point you to Josh Smith's article on The CodeProject.

Basically you need to create a TreeViewItem Style with a Setter like so:

<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />

Keep in mind though that the standard TreeView does not support multi selection of TreeViewItems. For that you need some addition code. I have not tried it myself but this article (http://www.mattlong.com.au/?p=41) looks promising.