This example demonstrates using the SaveLayout/LoadLayout methods that deal with a Stream to load/save the layout of a XamDockManager.
Imports Infragistics.Windows.DockManager
Private Const LayoutPath As String = "C:\layout.xml"
Private Sub mnuSaveToFile_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Using stream As System.IO.Stream = New System.IO.FileStream(LayoutPath, System.IO.FileMode.Create)
Me.dmLoadFile.SaveLayout(stream)
End Using
End Sub
Private Sub mnuLoadFromFile_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
If System.IO.File.Exists(LayoutPath) Then
Using stream As System.IO.Stream = New System.IO.FileStream(LayoutPath, System.IO.FileMode.Open)
Me.dmLoadFile.LoadLayout(stream)
End Using
End If
End Sub
using Infragistics.Windows.DockManager;
private const string LayoutPath = @"C:\layout.xml";
private void mnuSaveToFile_Click(object sender, RoutedEventArgs e)
{
using (System.IO.Stream stream = new System.IO.FileStream(LayoutPath, System.IO.FileMode.Create))
this.dmLoadFile.SaveLayout(stream);
}
private void mnuLoadFromFile_Click(object sender, RoutedEventArgs e)
{
if (System.IO.File.Exists(LayoutPath))
{
using (System.IO.Stream stream = new System.IO.FileStream(LayoutPath, System.IO.FileMode.Open))
this.dmLoadFile.LoadLayout(stream);
}
}
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem x:Name="mnuSaveToFile" Header="Save" Click="mnuSaveToFile_Click" />
<MenuItem x:Name="mnuLoadFromFile" Header="Load" Click="mnuLoadFromFile_Click" />
</MenuItem>
</Menu>
<!-- The Name property for all ContentPanes to be saved must be set. -->
<igDock:XamDockManager x:Name="dmLoadFile">
<igDock:XamDockManager.Panes>
<igDock:SplitPane x:Name="splitToolbox"
igDock:XamDockManager.InitialLocation="DockedLeft">
<igDock:ContentPane x:Name="paneToolbox" Header="Toolbox" />
</igDock:SplitPane>
<igDock:SplitPane
igDock:XamDockManager.FloatingSize="100,40"
igDock:XamDockManager.InitialLocation="FloatingOnly">
<!-- You can set SaveInLayout to false to prevent a pane
from being saved in the layout. If a pane will not
be saved then you don't have to specify the Name. -->
<igDock:ContentPane SaveInLayout="False"
Header="Find and Replace" />
</igDock:SplitPane>
<igDock:SplitPane x:Name="splitRight"
igDock:XamDockManager.InitialLocation="DockedRight">
<igDock:TabGroupPane x:Name="tabTrees">
<igDock:ContentPane x:Name="paneSolution"
Header="Solution Explorer" />
<igDock:ContentPane x:Name="paneClassView"
Header="Class View"
IsPinned="False" />
</igDock:TabGroupPane>
</igDock:SplitPane>
<igDock:SplitPane x:Name="splitOutput"
igDock:XamDockManager.FloatingSize="100,40"
igDock:XamDockManager.InitialLocation="DockableFloating">
<igDock:ContentPane x:Name="paneOutput"
Header="Output" />
</igDock:SplitPane>
</igDock:XamDockManager.Panes>
<igDock:DocumentContentHost>
<igDock:SplitPane x:Name="rootDocSplit">
<igDock:TabGroupPane x:Name="mainGroup">
<igDock:ContentPane x:Name="file1" Header="File 1" />
<igDock:ContentPane x:Name="file2" Header="File 2" />
</igDock:TabGroupPane>
</igDock:SplitPane>
</igDock:DocumentContentHost>
</igDock:XamDockManager>
</DockPanel>
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2