Xceed Docking Windows for WinForms v2.3 Documentation
Batch Modifications

Welcome to Xceed Docking Windows for WinForms v2.3 > Basic Concepts > Batch Modifications

The Dock-layout Manager provides the SuspendLayout and ResumeLayout methods which allow for modifications to be "suspended" and made as a batch rather than one at a time. The SuspendLayout method temporarily suspends the layout logic for the dock-layout manager and its associated Tool Windows until the ResumeLayout method is called at which point normal layout logic resumes. 

When multiple operations are to be made to the dock-layout manager and its associated tool windows, it is recommended that the modifications be made between calls to the SuspendLayout and ResumeLayout methods to prevent repainting objects as well as increase performance.

Example

The following example demonstrates how to add a batch of tool windows to a dock-layout manager's tool windows collection as well as modify the state of some of the tool windows between calls to the SuspendLayout and ResumeLayout methods. 

The source code for the BasicTool class used in the example below is available for both VB.NET and C#.

VB.NET Copy Code

' This example assumes that there is a panel on a form named
' clientHostPanel and that it is the set as the ClientHost.
Dim m_manager As New DockLayoutManager( Me, clientHostPanel )     

' Call the SuspendLayout method to temporarily suspend the layout
' logic until ResumeLayout is called.
m_manager.SuspendLayout() 

m_manager.ToolWindows.Add( New BasicTool( "solution_tool", "Solution Explorer", _
                           New Bitmap( "c:\images\msdev.png" ) ) )

m_manager.ToolWindows.Add( New BasicTool( "properties_tool", "Properties", _
                           New Bitmap( "c:\images\file.png" ) ) )

m_manager.ToolWindows.Add( New BasicTool( "helpcontents_tool", "Contents", _
                           New Bitmap( "c:\images\Help.png" ) ) )

m_manager.ToolWindows.Add( New BasicTool( "helpindex_tool", "Index", _
                           New Bitmap( "c:\images\index.png" ) ) ) 

Dim solutionTool As ToolWindow = m_manager.ToolWindows( "solution_tool" )
Dim helpTool As ToolWindow = m_manager.ToolWindows( "helpcontents_tool" ) 

solutionTool.DockTo( DockTargetHost.DockHost, DockPosition.Left )

m_manager.ToolWindows( "properties_tool" ).DockTo( solutionTool, DockPosition.Group )
m_manager.ToolWindows( "helpindex_tool" ).DockTo( helpTool, DockPosition.Group ) 

solutionTool.ParentGroup.State = ToolWindowState.AutoHide 

m_manager.AllowHide = False
m_manager.AllowFloating = False 

m_manager.AutoHideFrame.ShowHideDelay = 5
m_manager.AutoHideFrame.AnimationBehavior = AnimationBehavior.FirstShowAndLastHide
m_manager.AutoHideFrame.AnimationDuration = 250 

' Resume normal layout logic
m_manager.ResumeLayout()

C# Copy Code

// This example assumes that there is a panel on a form named
// clientHostPanel and that it is the set as the ClientHost.
DockLayoutManager m_manager = new DockLayoutManager( this, clientHostPanel );     

// Call the SuspendLayout method to temporarily suspend the layout
// logic until ResumeLayout is called.
m_manager.SuspendLayout(); 

m_manager.ToolWindows.Add( new Xceed.DockingWindows.Samples.BasicTool( "solution_tool", "Solution Explorer", new Bitmap( @"c:\images\msdev.png" ) ) );

m_manager.ToolWindows.Add( new Xceed.DockingWindows.Samples.BasicTool( "properties_tool", "Properties", new Bitmap( @"c:\images\file.png" ) ) );

m_manager.ToolWindows.Add( new Xceed.DockingWindows.Samples.BasicTool( "helpcontents_tool", "Contents", new Bitmap( @"c:\images\Help.png" ) ) );

m_manager.ToolWindows.Add( new Xceed.DockingWindows.Samples.BasicTool( "helpindex_tool", "Index", new Bitmap( @"c:\images\index.png" ) ) ); 

ToolWindow solutionTool = m_manager.ToolWindows[ "solution_tool" ];
ToolWindow helpTool = m_manager.ToolWindows[ "helpcontents_tool" ]; 

solutionTool.DockTo( DockTargetHost.DockHost, DockPosition.Left );

m_manager.ToolWindows[ "properties_tool" ].DockTo( solutionTool, DockPosition.Group );
m_manager.ToolWindows[ "helpindex_tool" ].DockTo( helpTool, DockPosition.Group ); 

solutionTool.ParentGroup.State = ToolWindowState.AutoHide;

m_manager.AllowHide = false;
m_manager.AllowFloating = false; 

m_manager.AutoHideFrame.ShowHideDelay = 5;
m_manager.AutoHideFrame.AnimationBehavior = AnimationBehavior.FirstShowAndLastHide;
m_manager.AutoHideFrame.AnimationDuration = 250; 

// Resume normal layout logic       
m_manager.ResumeLayout();

The same appearance can be achieved without performing the operations as a batch however blinking of the tool windows could occur as they are added to the ToolWindows collection of the dock-layout manager and when their state is changed.