Version

LoadLayout(Stream) Method

Loads a layout that was saved with the SaveLayout(Stream) method.
Syntax
'Declaration
 
Public Overloads Sub LoadLayout( _
   ByVal stream As Stream _
) 
public void LoadLayout( 
   Stream stream
)

Parameters

stream
The stream containing the saved layout.
Exceptions
ExceptionDescription
System.InvalidOperationExceptionThe layout cannot be loaded if the dockmanager is in an operation that doesn't allow it such as when a pane or tool window is being dragged. You should use the LoadLayout overload that takes a boolean for the 'processAsyncIfNeeded' parameter with a value of true or wait for the IsLoadLayoutAllowed to return true.
Remarks

Note: If the IsLoadLayoutAllowed is false then an exception will be thrown. To have the layout be automatically loaded when the blocking operation is complete, use the LoadLayout(Stream,Boolean) and pass true to allow the load to occur asynchronously.

Example
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>
Requirements

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

See Also