DockManager
implements the core algorithms that move, swap and split dockables. It is created by DockControl
but you can also instantiate it manually for custom hosts.
DockControl
free from layout code.PreventSizeConflicts
property which blocks two fixed-size tools from being docked together.DockControl
automatically creates a DockManager
when constructed. To use your own instance set the DockManager
property before displaying the control:
var dockManager = new DockManager
{
PreventSizeConflicts = true
};
var dockControl = new DockControl
{
DockManager = dockManager,
Layout = factory.CreateLayout()
};
During a drag operation DockControlState
calls DockManager.ValidateDockable
to test potential drop targets. When the pointer is released the same call is executed with bExecute: true
so the layout is updated.
DockManager
is a regular class so you can inherit from it and override any method. This is useful when the standard rules do not match your application’s requirements. Common customisations include:
Example overriding ValidateTool
to forbid tools from floating:
public class CustomDockManager : DockManager
{
public override bool ValidateTool(ITool sourceTool, IDockable target, DragAction action, DockOperation operation, bool execute)
{
if (operation == DockOperation.Window)
return false;
return base.ValidateTool(sourceTool, target, action, operation, execute);
}
}
Assign the subclass to the control as shown earlier. All other methods will continue to use the default logic.
PreventSizeConflicts
. When splitting tools always respect this flag or provide an alternative mechanism to avoid invalid layouts.bExecute: false
then re-validates with bExecute: true
on drop. Your overrides should follow this pattern to avoid inconsistent states.The manager is a small but critical part of Dock. By tailoring it you can adapt the docking behaviour to suit almost any workflow.
For an overview of other concepts see the documentation index.