How to traverse a treeview in WPF and get values from all nodes : Okay, I'm ready for the downvotes and the snide comments but I can't find an answer to this question now matter how I ask it. There appears to be solutions if the treeview is in WinForms but not if it's in WPF.

I'm loading an XML file at runtime that is bound to a treeview called OOB. The user can perform all kinds of edits to the treeview (adding and deleting nodes, changing the node's contents, etc.). All of this works perfectly. Now, I have to save it back out as an XML file. Apparently, this is near impossible in WPF.

At this point all I can think of doing is traversing the entire tree (from what I've read it may be necessary to first expand all nodes which is easily enough done) and then I can, one by one, read the nodes and write them to an XML file using `xmlWriter`.

So, unless somebody has a better idea, how can I in C# and WPF traverse an entire tree, getting the contents of each `Node.name`? Once I have the contents of each node I should be able to reconstitute the tree structure and write them out as an XML file.

Thanks in advance!
