I want to add an object from my viewmodel to a treeview, but I don't want to use a tree view item.
is there a way to do something like this?
<TreeView>
<SomeTag Object="{Binding MyViewModel.MyObject}/>
</TreeView>
The problem is that I'm trying to bind to a non-homogenous data structure
ClassA
ClassB
ClassC (Collection)
ClassD
ClassD
...
I don't want a node for class A
Added a TreeViewItem for ClassB with static Header text.
Added a TreeViewItem for ClassC with static header text, bound ItemsSource to ClassC, and bound DisplayMemberPath set to a Name property.
Bind another control ro TreeView.SelectedItem. If I click a ClassB or ClassC item, the SelectedItem is a TreeViewItem. If I click a ClassD item, the SelectedItem is my object.
If trying to consistently get my object.