Search code examples
c#wpftreeviewtreeviewitem

Searching And Selecting a TreeView Item programmatically?


In my 3d application, I have a TreeView that is databound to an ObservableCollection of objects in my 3d scene. In theory a user can click on an object in the 3d view, which should update the TreeView to select the corresponding item. But I don't exactly know how. All I have is the 3d object the user picked.

How do I go about doing this?


Solution

  • Found the solution right here.

    http://blog.quantumbitdesigns.com/2008/07/22/programmatically-selecting-an-item-in-a-treeview/

    And he's got sample source code that works, which kicks all kinds of ass.