Treeview ContainerFromItem always returns null
Is the item actually a child of the masterTreeView
?
This might actually be quite difficult since TreeViewItems
are ItemsControls
with their own ItemContainerGenerator
which means you should only be able to get the container from the immediate parent's ItemContainerGenerator
and not from the root.
Some recursive function which first goes up the hierarchy to the root and then reverses this route on the ui level always getting the container of the items might work out but your data-items need a reference to their logical parent data object.