I am having a view component (AvalonDock DockingManager) on which I would like to execute a method on:
- SaveDockingManagerLayout(xmlLayout); to save the currently used layout
- var layoutSerializer = new XmlLayoutSerializer(docManager); to load a layout
I have also written an article on this here:
http://www.codeproject.com/Articles/719143/AvalonDock-2-0-Tutorial-Part-5-Load-Save-Layout-wi
(see future development section)
Both commands (load and save layout) should be available at run-time (not just at application shut-down and start-up). I would like to initiate the load command in the viewmodel, somehow trigger the load of the layout (which is an XML string), and get back an information when this is done.
Saving a layout is more involved since I want to trigger the command in the viewmodel, ask the view to show me the layout (again as XML string), and then save it in the viewmodel.
This is not just an AvalonDock problem but a problem that could apply to any layout function in any other WPF control! I named this problem 'round trip' because it involves the view to trigger an action that is implemented in the view, -and the view should then respond to supply a result (in this case an XML layout).
The whole workflow is of course ideal if the viewmodel can query the view whether triggering an action is acceptable at a given point. It would also be good if I had a design that does not involve waiting forever to receive a result :-) The solution should not involve an additional framework (Prism etc...) unless it is clear how the framework implements this...
I thought I know how to solve this but it turn out I do not have a clue :-( Please help me as I am getting frustrated hitting that wall again..
Does anyone ever had an experience with a round-trip problem like this? Please share your experience with me :-)