Some of DockLayoutManager’s panel groups can contain documents that were created from ViewModel with IDocumentManagerService. To serialize and restore these panels and their child documents correctly, it is necessary to perform the following steps.
Item names are used to identify items when saving/restoring the layout. For this reason, it is necessary to set unique names for all DockLayoutManager panels. In the current scenario, this can be done by setting the DocumentPanel.BindableName property in the TabbedDocumentUIService.DocumentPanelStyle.
Another important point is that the DockLayoutManager's save/restore mechanism is not the XamlWriter alternative — it does not save/restore the content of its panels. It is necessary to restore it. In this example, we use the following approach:
- Before saving layout settings, serialize all documents created from the ViewModel.
- Before restoring settings, recreate all documents.
- Converter.cs (VB: Converter.vb)
- Document.xaml (VB: Document.xaml)
- Document.xaml.cs (VB: Document.xaml.vb)
- MainViewModel.cs (VB: MainViewModel.vb)
- MainWindow.xaml (VB: MainWindow.xaml)
- MainWindow.xaml.cs (VB: MainWindow.xaml.vb)
- ViewModel.cs (VB: ViewModel.vb)
- Common Concepts - Save/Restore Control Layout
- WPF Dock Layout Manager - Save and Restore the Layout of Dock Panels and Controls
(you will be redirected to DevExpress.com to submit your response)