User Interface for .NET / User's Guide / Docking Panels / Dock Manager

Dock Manager
 Overview
The NDockManager component is the root object of a Nevron Docking Panels framework. It synchronizes docking panels and docking containers, supports batch operations, observes some events and notifies all dependant components, fires events bubbled to it, etc. It must be assigned a valid form where the root docking container will reside.
 Appearance

The NDockManager controls most of the aspects of visual representation. It exposes the following styles used to control docking framework's appearance:

The following example demonstrates how to change the tabs appearance using the TabStyle property:

C#
Copy Code
NTabStyle style = this.nDockManager1.TabStyle;
style.TabAlign = TabAlign.Top;
style.UseAutomaticTabStyle = false;
style.TabStyle = TabStyle.Buttons;
style.Font = new Font("Arial", 9.0f);
Visual Basic
Copy Code
Dim style As NTabStyle = Me.nDockManager1.TabStyle
style.TabAlign = TabAlign.Top
style.UseAutomaticTabStyle = false
style.TabStyle = TabStyle.Buttons
style.Font = New Font("Arial", 9.0F)

The result of the above code.

 Adding Containers

Each element in the docking framework should be attached to a valid NDockManager instance in order to function properly. You should use the manager to create and add docking containers as it will automatically update the container's references. By default when assigned a valid Form instance the manager will add its RootContainer to the Form's controls collection. If you want to add additional nested containers use the manager's AddContainer method.

 

The following code demonstrates how to add docking containers:

C#
Copy Code
//create a valid manager and attach it to the form
NDockManager nDockManager1 = new NDockManager();
nDockManager1.Form = this;

//create a container
NDockingPanelContainer container = this.nDockManager1.AddContainer(DockStyle.Fill);
//add the container as a child to an existing docking panel
this.nDockingPanel1.Controls.Add(container);
Visual Basic
Copy Code
'create a valid manager and attach it to the form
Dim nDockManager1 As NDockManager = New NDockManager()
nDockManager1.Form = Me

'create a container
Dim container As NDockingPanelContainer = Me.nDockManager1.AddContainer(DockStyle.Fill)
'add the container as a child to an existing docking panel
Me.nDockingPanel1.Controls.Add(container)
 Notifications
As all unhandled events are bubbled up to the manager it fires the same events as a NDockingPanel but with the prefix "Panel" - for example Activated will be PanelActivated. For more information about docking panels notifications see Docking Panels.
 Batch Operations

The NDockManager component might start batch operation which actually suspends any layout and notification events.

 

The following code demonstrates how to start and end a batch operation:

C#
Copy Code
this.nDockManager1.StartBatchOperation();

//perform your application-defined job here

//do not forget to end the batch operation
this.nDockManager1.EndBatchOperation();
Visual Basic
Copy Code
Me.nDockManager1.StartBatchOperation()

'perform your application-defined job here

'do not forget to end the batch operation
Me.nDockManager1.EndBatchOperation()
 Framework Updates

The NDockManager might be used to perform various updates on the entire docking framework.

 

The following table describes these methods:

 

Method Description

 NotifyCaptionUpdate

Forces all the panels with visible caption to re-measure and repaint them.

 NotifyLayout

Forces all containers and panels to perform layout.

 NotifyPaletteChange

Notifies all elements in the framework of a palette change.

 NotifyRefresh

Invalidates and updates the entire framework.

 NotifySplittersUpdate

Invalidates and updates all the splitters in the framework.

 NotifyTabPropertyChange

Notifies all docking panels that a property regarding tabs appearance has changed.

 NotifyTotalUpdate

Performs a batch of all updates.

 Queries

The NDockManager keeps track of all the containers and panels currently being part of the framework. It exposes lots of properties and methods to perform various queries upon framework's elements.

 

The following table demonstrates these queries:

 

Query Description

 ActivePanel

Gets the currently active panel for the framework. There can be only one at a time.

 Containers

Gets all the containers registered with the framework. Including both visible and hidden.

 Panels

Gets all the docking panels registered with the framework. Includes panels with any DockState.

 FindContainer

Searches for a INDockingPanelContainer with the specified ID.

 FindPanel

Searches for a INDockingPanel with the specified ID.

 FindZone

Searches for a INDockZone with the specified ID.

 GetContainers

Gets all containers with the specified DockStyle.

 GetPanels

Gets all the panels with the specified DockState.

 Remarks

The NDockManager provides some sharable object to be used by the entire framework. These are:

 

  • Renderer - the default renderer to be used by all UI elements in the framework.
  • LayoutEngine - the default layout engine to be used by all the dock zones in the framework.
  • DragHandler - the default INDragHandler implementation to be used by all docking panels.
See Also