I wanted to select a specific item in my Silverlight TreeView programatically. Looking at the TreeView.SelectedItem property the setter is not public so it cannot be done this way. If you are simply adding TreeViewItems to the TreeView you can cast the item you want to select in the Items collection to a TreeViewItem and set the IsSelected property to true. The following example will grab the first item and set it to selected. If you are binding a list … →
↧