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);
}
Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim s As String = "default.xml"
Dim dialog As New SaveFileDialog()
dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"
dialog.Title = "Select a xml file"
If dialog.ShowDialog() = DialogResult.OK Then
s = dialog.FileName
End If
Me.radLayoutControl1.SaveLayout(s)
End Sub
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);
}
Private Sub LoadButton_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim s As String = "default.xml"
Dim dialog As New OpenFileDialog()
dialog.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"
dialog.Title = "Select a xml file"
If dialog.ShowDialog() = DialogResult.OK Then
s = dialog.FileName
End If
Me.radLayoutControl1.LoadLayout(s)
End Sub
The layout can be saved/loaded with the customize dialog as well.