I am working on a WPF application which has a treeview that represents an XML. I load the XML on to the XDocument, then bind the TreeView to this object.
Now using the MVVM pattern, I want to provide a ViewModel on top of XDocument. What are some of the things that I should implement in the ViewModel class.
I am thinking of,
- RoutedCommands that bind to ContextMenu commands on the TreeView to allow add node, remove node, modify node etc
- Logic to actually modify attributes and nodenames on the view.
Am I going in the right direction? What else should I do to make it cleaner, modular at the same time easy to understand.
Should I use RoutedCommands or implement ICommand interface and create my commands? How about using attached properties for CommandBindings? does it make sense to do it in the treeview app that I am talking about? I am a bit overwhelmed because of so many options available to implement this.
Does anyone have links, sample code that does this sort of thing? A reference implementation may be?