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
Hello Kris,
The code I sent you before only saved the layout when the user dragged panes to move them around. It does not save the layout when a pane is pinned/unpinned. I have attached a modified sample which keeps track of when panes are pinned/unpinned and saves the layout when it happens.
I do have another question actually. This approach remembers the position of the panes but not that they were pinned or unpinned. I tried this same scenario with
using (FileStream fs = new FileStream("layout.xml", FileMode.Create, FileAccess.Write)) { this.XamDockManager1.SaveLayout(fs); }
in a code behind and this does remember the pining of panes . How come it works with this.XamDockManager1.SaveLayout(fs) but not with the mvvm approach you outlined?
Great example. Exactly what I was looking for.
Do you have any other questions on this matter?
Sincerely,Valerie Developer Support Supervisor - XAMLInfragisticswww.infragistics.com/support
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.