Version

Save an End User’s Docking Layout

The xamDockManager™ control allows your end users to modify the layout of your application. Your end users will expect you to save these settings so that they do not have to modify the layout when they restart your application. The xamDockManager control exposes an overloaded SaveLayout method that you can use to save a docking layout.

You can call the SaveLayout method without a parameter to retrieve the docking layout as an XML string. This functionality is useful if you want to implement functionality that restores your application’s default layout. Instead of writing your application’s default layout to a Stream object, you can store the default layout as a string when your application starts up. If your end user wants to restore the default layout, you can pass the XML string to the LoadLayout method instead of a Stream object.

The following example code demonstrates how to save a layout.

In Visual Basic:

Imports System.IO
...
Using fs As New FileStream("layout.xml", FileMode.Create, FileAccess.Write)
    Me.xamDockManager1.SaveLayout(fs)
End Using
...

In C#:

using System.IO;
...
using (FileStream fs = new FileStream("layout.xml", FileMode.Create, FileAccess.Write))
{
    this.xamDockManager1.SaveLayout(fs);
}
...