Hello. I have 2 questions.
I'm using a xamoutlook bar. One of the outlookbar groups has the dock manager. The others have different content. So when they click on a different outlookbar group the content gets swapped out.
<ContentControl Content="{Binding CurrentViewModel}" Grid.Row="1" Grid.Column="1"/>
So say someone rearranges the all the panes in the dockmanager then clicks on a different outlookbar group then clicks back to the one with the dock manager. The layout resets to what is defined statically in the xaml. In order to remember what the layout was I'm assuming that I will have to save the layout every time a bar group other then the one with the dock manager gets click to remember how the user left the layout. Is this correct or is there some other way of doing this without saving to a file? I'm asking cause I'm not closing the application just swapping the content in ContentControl.
Second question.
When I save a layout I need to get a handle of the DockManager. How can I do this if I'm using the mvvm pattern? Would I somehow bind to the DockManager like binding to properties? I could do it in a code behind since I can directly reference the DockManager. So a button click would trigger an event which would trigger the saveLayout method but then I'm breaking the mvvm pattern.
Thanks
Hi Kris,
This is the expected behavior. When you swap out the content like that, the old UI elements are thrown out. When you bring the dockmanager back, it recreates all the elements again which is why it appears to lose its updated layout. At the moment I'm not sure of the best way to handle this in an MVVM friendly way, I'm currently looking into this. But SaveLayout and LoadLayout are going to be necessary in maintaining the layout. I'll update you once I've found a good way to do this with MVVM.
Hello Kris,
Please see the attached sample. I created a behavior that will restore the layout of the dockmanager when it is constantly Loaded/Unloaded. It makes use of a view model property in order to retain the layout xml so in order for this to work you'll need to create a string property in your dockmanager view model and then bind it to the behavior's Layout property.
Let me know if you have any questions.