Xceed Docking Windows for WinForms v2.3 Documentation
Dock-layout Manager
Welcome to Xceed Docking Windows for WinForms v2.3 > Basic Concepts > Dock-layout Manager

The DockLayoutManager manages the interaction of its associated tool windows in and around the defined host areas as well as in relation to each other (see also Tool Windows). Through the dock-layout manager, end-user interaction with tool windows can be partially or completely restricted, and their size, location, visibility, and state can be saved and loaded.

Dock-host vs. Client-host

In addition to managing its associated Tool Windows, the dock-layout manager also defines and manages the DockHost and the ClientHost. In an SDI application, the dock-host is the control in which the tool windows can be docked while the client-host, which must be a child of the dock-host and is optional, is the control around which tool windows can be docked (work area). The client-host will always be docked in the dock-host and will occupy the space not occupied by tool windows. This means that if no tool windows are contained in the dock-host, the client-host will occupy all of the space in the dock-host.

In an MDI application, the client-host will always be the MDI client (where the MDI children are located) of the MDI container (dock-host). Any control assigned as the client-host will be ignored (see also Tabbed-MDI Manager).

Tool Windows

The DockLayoutManager class exposes the AllowFloating and AllowDocking properties, which can prevent the end-user from changing the state of tool windows interactively. The AllowFloating property indicates whether docked tool windows can become floating, while the AllowDocking property indicates whether floating tool windows can become docked, as well as preventing currently docked tool windows from being docked in another location. Neither the AllowFloating nor the AllowDocking property changes the current state of tool windows (i.e., floating tool windows will remain floating even if AllowFloating is set to false). 

The dock-layout manager class also exposes the AllowAutoHide and AllowHide properties. The AllowAutoHide property indicates whether docked tool windows can become auto-hide tool windows and vice-versa, by displaying or removing the auto-hide "pin/unpin" glyph () and the "Auto Hide" option from the context menu. The AllowHide property indicates whether tool windows can be hidden by displaying or removing the hide glyph () and the "Hide" option from the context menu. 

The AllowFloating, AllowDocking, AllowAutoHide, and AllowHide properties only apply to end-user interactivity with tool windows; they do not prevent the state or visibility of tool windows from being changed programmatically. 

The active tool window can be retrieved via the dock-layout manager's ActiveToolWindow property. Calling a tool window's Activate method will activate the tool window. If a tool window is activated using the Activate method, it will be made visible, get the focus, and be brought to the front. If no tool window has the focus, the ActiveToolWindow property will return null (Nothing in Visual Basic).

Dock-sites and Drop-cues

Tool windows can be docked in the dock-host, around the client-host or with another tool window. In order to dock a tool window, it must be dragged to the appropriate dock-site. Dock-sites are specific areas on or in the dock-host, client-host, and tool windows where tool windows can be docked. When a tool window is being dragged, drop-cues will appear when the mouse passes over a dock-site indicating the region where the tool window would be docked if it is dropped.

The dock-layout manager's Style property determines how the drop-cues that identify the dock-sites are drawn. If set to VS2003 (Visual Studio 2003), rectangles will be drawn to represent the dock-sites (see Figure 1). If set to VS2005 (Visual Studio 2005), drop-cues like those in Visual Studio 2005 will appear to indicate the possible dock-sites (see Figure 2).


Figure 1: Visual Studio 2003 drop-cues

Figure 2: Visual Studio 2005 drop-cues

Layouts

The size, location, visibility, and state of a tool window can be saved and loaded using the SaveLayout and LoadLayout methods. If a tool window specified in the layout does not exist in the ToolWindows collection before the layout is loaded, an exception will be thrown. Normally, a layout would be saved when the application is being closed and loaded after the tool windows have been added to the dock-layout manager's ToolWindows collection.