views:

154

answers:

1

I have a WPF treeview that is databound to an XmlDataProvider - the XML source is used by many PCs. When the XmlDataProvider is refreshed all the TreeViewNodes collapse. I would like each PC to remember the status of the IsExpanded attribute.

I understand that I could add an IsExpanded property to the XML, however then this would be updated to all PCs that use the central XML file. Is there any other solutions to remember which nodes are expanded?

Thanks!

A: 

You could create classes that wrap the XML data, bind to the class, then add the IsExpanded property to this class so it only affects only the current user's view. (You probably don't want to go to all that work.)

Or, you could bind the IsExpanded attribute to a converter that uses some identifying feature of the XML row. The converter could use any sort of internal data structure to remember whether a node is expanded or not.

John Fisher