Version

LoadLayout(String) Method

Loads a layout saved with the SaveLayout method.
Syntax
'Declaration
 
Public Overloads Sub LoadLayout( _
   ByVal layout As String _
) 
public void LoadLayout( 
   string layout
)

Parameters

layout
The string 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(String,Boolean) and pass true to allow the load to occur asynchronously.

Example
This example demonstrates how to use the overloads of SaveLayout and LoadLayout that deal with a string to restore the state of a XamDockManager.

Imports Infragistics.Windows.DockManager

Private _originalLayout As String

Private Sub dmResetLayout_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
    ' save the original layout when the dockmanager was first 
    ' loaded so we can restore it later 
    Dim dm As XamDockManager = TryCast(sender, XamDockManager)
    Me._originalLayout = dm.SaveLayout()
End Sub

Private Sub mnuResetLayout_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Me.dmResetLayout.LoadLayout(Me._originalLayout)
End Sub
using Infragistics.Windows.DockManager;

private string _originalLayout;

private void dmResetLayout_Loaded(object sender, RoutedEventArgs e)
{
	// save the original layout when the dockmanager was first
	// loaded so we can restore it later
	XamDockManager dm = sender as XamDockManager;
	this._originalLayout = dm.SaveLayout();
}

private void mnuResetLayout_Click(object sender, RoutedEventArgs e)
{
	this.dmResetLayout.LoadLayout(this._originalLayout);
}
<DockPanel>
    
<Menu DockPanel.Dock="Top">
        
<MenuItem Header="File">
            
<MenuItem x:Name="mnuResetLayout" Header="Reset Window Layout" Click="mnuResetLayout_Click" />
        
</MenuItem>
    
</Menu>
    
<!-- The Name property for all ContentPanes to be saved must be set. -->
    
<igDock:XamDockManager x:Name="dmResetLayout" Loaded="dmResetLayout_Loaded">
        
<igDock:XamDockManager.Panes>
            
<igDock:SplitPane x:Name="splitToolbox2" 
                              
igDock:XamDockManager.InitialLocation="DockedLeft">
                
<igDock:ContentPane x:Name="paneToolbox2" Header="Toolbox" />
            
</igDock:SplitPane>
            
<igDock:SplitPane x:Name="splitFind2"
                
igDock:XamDockManager.FloatingSize="100,40"
                
igDock:XamDockManager.InitialLocation="FloatingOnly">
                
<igDock:ContentPane x:Name="paneFind2" 
                                    
Header="Find and Replace" />
            
</igDock:SplitPane>
            
<igDock:SplitPane x:Name="splitRight2"
                              
igDock:XamDockManager.InitialLocation="DockedRight">
                
<igDock:TabGroupPane x:Name="tabTrees2">
                    
<igDock:ContentPane x:Name="paneSolution2" 
                                        
Header="Solution Explorer" />
                    
<igDock:ContentPane x:Name="paneClassView2" 
                                        
Header="Class View" 
                                        
IsPinned="False" />
                
</igDock:TabGroupPane>
            
</igDock:SplitPane>
            
<igDock:SplitPane x:Name="splitOutput2" 
                              
igDock:XamDockManager.FloatingSize="100,40"
                              
igDock:XamDockManager.InitialLocation="DockableFloating">
                
<igDock:ContentPane x:Name="paneOutput2" 
                                    
Header="Output" />
            
</igDock:SplitPane>
        
</igDock:XamDockManager.Panes>
        
<igDock:DocumentContentHost>
            
<igDock:SplitPane x:Name="rootDocSplit2">
                
<igDock:TabGroupPane x:Name="mainGroup2">
                    
<igDock:ContentPane x:Name="file1a" Header="File 1" />
                    
<igDock:ContentPane x:Name="file2a" 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