Hi!

Im currently working with a WPF application, where the customer has complained about a treeview view. When the user add an item to the treeview, and then press save, all changes are persisted in the database, and the new "node" get a unique id, which is returned to the node object. After this the whole viewmodel is recreated to add the new id to the collection in the viewmodel. A little bit messy, but that is the way it has to be solved by reloading the entire tree from the db due to certain dependencies. The problem with this is that the treeview is collapsed after the view/viewmodel is reloaded. So after each save the user has to expand the tree again. Kind of annoying...

WHich is the correct wa to handle this in WPF so the view persist its state? Do I have to handle this manually or are there any clever methods/patterns I can use?

kind regards
/S