Set Active Node from View Model

Mar 12, 2014 at 3:44 PM
Is it possible to set the active node in the tree programatically ?
I would like to be able to focus (activate) a node from my view model.

The LastSelectedItem property does not have a setter. When I try to use SelectedItems property (tree.SelectedItems.Add(<some node>), the selected item do not get focus.

Mar 19, 2014 at 2:42 PM

if you know the UIElement, you could try the WPF-Tools (call focus on it). You might want to use the System.Windows.Controls.FocusHelper from the TreeViewEx assembly.

If you want to set the selected item by using its data representation, there is no other way but setting it at last into the selecteditems collection.