In my treeview I want to remember which nodes were expanded and redraw that state after I delete or insert a node. I solved that with remembering the index of an expanded node. If a node is removed, I decrement all indeces that were afterwards.
That works because I can access the deleted node with treeView.SelectedNode, but how can I get the new Index of the inserted node?
I can not solve it with saving a reference to the node or a name or a tag, because when I redraw the tree the nodes are created completely new – and I think I can not get a reference to the newly created node anyway
Best regards, Expecto
In my treeview I want to remember which nodes were expanded and redraw that
Share
The answers were not really what I was looking for, but after I found out that after an insert the “AfterSelect” Event fires, I did it this way:
My treeview then handles the changed indices for the nodes after that and perfectly redraws the tree.