i need to clone an entire treeview to implement Undo\Redo actions. i try in different ways but it appears that directly isn’t possible. I mean copying the entire treeview, save that copy in a list. Then when the Undo action is requested decrement a specific counter of levels of undo and replace the actual treeview with the treeview that exist in the index positions of the list. if I do redo the same happens but lvls is incremented so i recover what come next. Every time that a modifications occurs in the treeview i need to save that copy and increment the lvl counter
Share
Instead of cloning the treeview itself you could simply clone the TreeNodes (see TreeNode.Clone()). It seems like the important bit is the relationship between the nodes, so this would probably work for you (I say “probably” because I haven’t actually done this myself, so I can’t tell you if there are any caveats to be wary of).