Save and restore the LayoutControl's layout
The layout of controls within a Layout Control can be saved to a data store and restored later. This comes in handy when you allow your end-users to customize a layout in Customization mode.
To save a layout to a data store, use LayoutControl's LayoutControlBase.WriteToXML inherited method. The LayoutControl.ReadFromXML method restores the saved layout.
NOTE
To correctly save and then restore the layout of items, you need to assign names to the items. If names are not specified, the layout will be correctly restored, provided that the Layout
To load a layout, we recommend using the Loaded event of a User
#Example
The following example shows how to save the layout of items of a LayoutControl object to a stream, and then restore the layout. The LayoutControlBase.WriteToXML and LayoutControl.ReadFromXML methods are used to do this.
using System.Xml;
using System.IO;
MemoryStream stream = new MemoryStream();
//Save the layout
XmlWriter writer = XmlWriter.Create(stream);
myLayoutControl.WriteToXML(writer);
writer.Close();
//Load the layout
stream.Seek(0, SeekOrigin.Begin);
XmlReader reader = XmlReader.Create(stream);
myLayoutControl.ReadFromXML(reader);
reader.Close();