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?

+1


a source to share


2 answers


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.

+4


a source


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?

-2


a source







All Articles