Finding and selecting a TreeView item programmatically?
In my 3D application, I have an TreeView
object snapped to objects ObservableCollection
in my 3d scene. In theory, the user could click on an object in the 3D view, which must update TreeView
to select the corresponding item. But I don't know exactly how to do it. All I have is a 3D object that the user has selected.
How can I do it?
a source to share
Found solution is correct here .
http://blog.quantumbitdesigns.com/2008/07/22/programmatically-selecting-an-item-in-a-treeview/
And he got a sample source code that works that kicks all kinds of donkey.
a source to share
I would assume that both the tree object and the scene element will share (and be identified) by a common ID value. Then, in your 3D scene or Treeview, implement and subscribe to the OnSelectionChanged that your TreeView probably has. Then, when one is updated / changed, the other should be immediately notified and updated accordingly. Remember to eat the changes, of course, even when you update, or you'll create a nasty OnChange event loop.
... or I didn't understand your question?
a source to share