New to Telerik UI for WinForms? Start a free 30-day trial
Loading And Saving Layouts
Updated over 6 months ago
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
C#
this.radDock1.SaveToXml("c:\\layout1.xml");
You can use the DockWindowSerializing event to exclude windows from the saved layout:
C#
void radDock1_DockWindowSerializing(object sender, DockWindowCancelEventArgs e)
{
if (e.NewWindow.Text == "Window Top")
{
e.Cancel = true;
}
}
To Load a Layout
To load a layout, call the RadDock.LoadFromXML method:
LoadFromXml
C#
this.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) | ![]() |
