Loading And Saving Layouts
RadDock provides methods to save and load layouts. A layout records the size and arrangement of all DockWindows within RadDock. This saves all managed windows (ToolWindow and DocumentWindow) regardless of state (i.e. a window may be hidden or floating and still be saved).
To Save a Layout
To save a layout, call the RadDock.SaveToXML method:
SaveToXml
this.radDock1.SaveToXml("c:\\layout1.xml");
Me.RadDock1.SaveToXml("c:\layout1.xml")
You can use the DockWindowSerializing event to exclude windows from the saved layout:
void radDock1_DockWindowSerializing(object sender, DockWindowCancelEventArgs e)
{
if (e.NewWindow.Text == "Window Top")
{
e.Cancel = true;
}
}
Private Sub radDock1_DockWindowSerializing(ByVal sender As Object, ByVal e As DockWindowCancelEventArgs)
If e.NewWindow.Text = "Window Top" Then
e.Cancel = True
End If
End Sub
To Load a Layout
To load a layout, call the RadDock.LoadFromXML method:
LoadFromXml
this.radDock1.LoadFromXml("c:\\layout1.xml");
Me.RadDock1.LoadFromXml("c:\layout1.xml")
With the introduction of the R3 2023 SP1 version of our controls, the LoadFromXml() expose second (optional) parameter. This parameter provides the option to specify whether to remove all existing dock windows or not. By default, the second parameter is set to false.
RELATED VIDEOS | |
---|---|
Saving and Loading RadDock for WinForms Layouts In this video, you will learn how to use the simple XML serialization features of RadDock for WinForms to easily save and load RadDock layouts. (Runtime: 07:03) |