Overview

The docking data model consists of three core types that work together to represent the full docking state:

  • DockPanel — The atomic unit: a single dockable content window
  • DockGroup — A tree node organizing panels and nested groups
  • DockLayoutTree — The root container owning the full hierarchy

DockPanel

Namespace: TheTechIdea.Beep.Winform.Controls.Docking.Models
Inheritance: System.Windows.Forms.Panel

Key Properties

PropertyTypeDescription
KeystringUnique identifier (required)
TitlestringDisplay title in caption/tab. Default "Tool Window"
ContentControlHosted user control. Set to fill panel
StateDockPanelStateCurrent display state (Docked/Float/AutoHidden/Hidden/Closed)
DockPositionDockPositionDocked edge (Left/Right/Top/Bottom/Fill)
GroupDockGroupOwning group. Set internally by manager
CanClose / CanFloat / CanAutoHideboolCapability flags controlling allowed operations
AllowedAreasDockAreasBitmask of allowed dock positions
IsDirtyboolUnsaved changes indicator (asterisk in tab)
ShowCaptionboolDraw own caption bar. True when floating
PreferredWidth / MinWidthintSizing constraints

Key Events

  • Activated / Deactivated — Panel selection changed
  • Closed — Panel moved to closed store
  • PropertyChanged — Panel property changed

DockGroup

Inheritance: object (not a control — pure data model)

Key Properties

PropertyTypeDescription
IdstringUnique GUID identifier (default: Guid.NewGuid())
PositionDockPositionDocked edge
SplitOrientationSplitOrientationHorizontal or Vertical split direction for child groups
SplitRatiofloatProportional split (0.1-0.9, default 0.5)
ParentDockGroupParent group (null for root)
ChildrenIReadOnlyList<DockGroup>Child groups (for split layouts)
PanelsIReadOnlyList<DockPanel>Panels in this group
ActivePanelDockPanelCurrently active panel. Setter fires events
BoundsRectangleCached client rectangle (set internally)

Key Methods

  • GetAllPanelsRecursive() — Flat list of all descendant panels
  • FindPanelRecursive(string key) — Deep search by panel key
  • GetPanelIndex(DockPanel) — Position within Panels list
  • ToString() — Diagnostic string showing structure

DockLayoutTree

Inheritance: object

Key Properties

PropertyTypeDescription
RootDockGroupRoot group (auto-creates on first get). Id="root", Position=Fill
SchemaVersionintLayout format version. Default 1
NamestringLayout name. Default "Default"
CreatedUtc / ModifiedUtcDateTimeTimestamps

Key Methods

  • RegisterPanel / UnregisterPanel — Panel registry management
  • RegisterGroup / UnregisterGroup — Group registry management
  • GetRootGroupsByPosition() — Root-level groups per DockPosition
  • GetDiagnostics() — Summary string of entire layout
  • Clear() — Resets all registries and root

Relationships

DockLayoutTree
  └── DockGroup (Root, Id="root", Position=Fill)
       ├── DockGroup (Position=Left)
       │    ├── DockPanel (Key="explorer", Title="Explorer")
       │    └── DockPanel (Key="toolbox", Title="Toolbox")
       ├── DockGroup (Position=Fill, SplitOrientation=Horizontal)
       │    ├── DockGroup (child, no position)
       │    │    └── DockPanel (Key="editor1")
       │    └── DockGroup (child, no position)
       │         └── DockPanel (Key="editor2")
       └── DockGroup (Position=Bottom)
            └── DockPanel (Key="output")

Examples

// Navigate the tree
var root = manager.LayoutTree.Root;
foreach (var posGroup in root.Children)
{
    Console.WriteLine($"Group {posGroup.Id}: {posGroup.Position}");
    foreach (var panel in posGroup.GetAllPanelsRecursive())
        Console.WriteLine($"  Panel: {panel.Key} = {panel.Title}");
}

// Find specific panel
var explorer = manager.LayoutTree.FindPanel("explorer");
var ownerGroup = explorer.Group;  // owning DockGroup
var siblings = ownerGroup.Panels;  // panels in same group