Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Save and restore layout of items in LayoutControl

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();