How to get the visual parent of a bound treeviewItem? (not actually a treeviewitem but my own object)
I know there are alot of posts about this problem, but I can't seem to get any of the solutions to work.
I have this simple task(so I thought) to find the parent of an item in my treeview. The item is not a TreeViewItem it is my own type.
The class I use to build the treeview has children of its own class, so its only one type of objects in the treeview.
I want to be able to move any items into another so it becomes the child of the new item. This works well by adding it to the children property of my class. I do that by dragging a node onto another node. But how do I remove it from the original object? When
I start dragging, the node becomes selected, and here is a perfect place to put the magic code. MagicTreeViewHelper.getTheFreakinParentNode(myDraggedObject). Please help me make this method!! ;)
I cant go through the data and remove the child from all the other items because it is allowed for any item to be a child of multiple nodes.
So I need to access the visual parent node which contains the bound object from which I'm dragging the item from.
One solution that seems to be the answer everywhere I look is some variant of the code below:
Already on the first line it fails, because I dont have TreeViewItems in my tree...
View Complete Post