Saving and loading of the layout is possible with custom LayoutDocuments (class derived from LayoutDocument) as long as they are docked in the LayoutDocumentPane. But if a LayoutDocument is dragged onto an other screen, the custom LayoutDocument is stored in a LayoutDocumentFloatingWindow.
If now the custom LayoutDocument is saved/loaded the custom type isn't stored in the XML file. The XML file contains a RootDocument instead of the custom derived class name.
Therefore saving/load a CUSTOM LayoutDocument in a LayoutDocumentFloatingWindow is not possible.
To solve this, I made a proposal for serializing LayoutDocumentFloatingWindow, LayoutFloatingWindow and LayoutAnchorableFloatingWindow. Serialization is performed by implementing the IXmlSerializable interface.
The nasty thing was that in the layout XML file I wanted the following structure:
<FloatingWindows>
<LayoutDocumentFloatingWindow>
<CustomLayoutDocument1 />
<LayoutDocumentFloatingWindow />
<LayoutDocumentFloatingWindow>
<CustomLayoutDocument2 />
<LayoutDocumentFloatingWindow />
<FloatingWindows />
Therefore I had to implement the IXmlSerializable in LayoutRoot.
See attached files with the solutions and an example of the resulting XML file.
If now the custom LayoutDocument is saved/loaded the custom type isn't stored in the XML file. The XML file contains a RootDocument instead of the custom derived class name.
Therefore saving/load a CUSTOM LayoutDocument in a LayoutDocumentFloatingWindow is not possible.
To solve this, I made a proposal for serializing LayoutDocumentFloatingWindow, LayoutFloatingWindow and LayoutAnchorableFloatingWindow. Serialization is performed by implementing the IXmlSerializable interface.
The nasty thing was that in the layout XML file I wanted the following structure:
<FloatingWindows>
<LayoutDocumentFloatingWindow>
<CustomLayoutDocument1 />
<LayoutDocumentFloatingWindow />
<LayoutDocumentFloatingWindow>
<CustomLayoutDocument2 />
<LayoutDocumentFloatingWindow />
<FloatingWindows />
Therefore I had to implement the IXmlSerializable in LayoutRoot.
See attached files with the solutions and an example of the resulting XML file.