New to Telerik UI for WinForms? Download free 30-day trial

Save/Load Layout

RadLayoutControl allows layout changes at runtime. To preserve the changed layout you can use the predefined SaveLayout and LoadLayout methods. Both methods can take path, stream or XmlWriter as parameters. The following example demonstrates the functionality:

Save Layout


private void SaveButton_Click(object sender, EventArgs e)
{
    string s = "default.xml";
    SaveFileDialog dialog = new SaveFileDialog();
    dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
    dialog.Title = "Select a xml file";
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        s = dialog.FileName;
    }
    this.radLayoutControl1.SaveLayout(s);
}

Load Layout


private void LoadButton_Click(object sender, EventArgs e)
{
    string s = "default.xml";
    OpenFileDialog dialog = new OpenFileDialog();
    dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
    dialog.Title = "Select a xml file";
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        s = dialog.FileName;
    }
    this.radLayoutControl1.LoadLayout(s);
}

The layout can be saved/loaded with the customize dialog as well.