BeepDockspaceDesigner
The ParentControlDesigner for BeepDockspace — enables tab drag-drop reordering, header click routing, and intelligent move snapping at design time
Overview
Namespace: TheTechIdea.Beep.Winform.Controls.Design.Server.Docking.Designers
Inheritance: ParentControlDesigner
Visibility: internal sealed
BeepDockspaceDesigner manages the design-time experience for BeepDockspace controls — the visual containers that hold docked panels and render tab strips with captions. At design time, it enables tab reordering via drag-drop within the header area and intelligent repositioning when the entire dockspace is moved.
Key Features
- Tab drag-drop — Users can drag tab headers within the dockspace's header bar to reorder panels at design time
- Header click routing — Clicks on the header area at design time are properly routed for tab selection
- Move snapping — When the dockspace is dragged, it recalcalculates the nearest DockPosition from its new center
- Resize forwarding — Resize operations delegate to BeepDockingDesignerWiring for proportional recalculation
- Selection rules — Visible and AllSizeable for proper designer interaction
Design-Time Behavior
GetHitTest
The GetHitTest() override returns true only when the dockspace is the primary selection AND the click point is within the header area. This allows tab header interactions at design time while letting non-header areas pass through to the contained panels.
Move Snapping
When the user moves a dockspace in the designer, HandleDockspaceMove() calculates the nearest DockPosition based on the center point of the dockspace relative to the host form bounds. This is similar to DockPanel's move snapping but operates at the dockspace level.
ComponentChanged Handling
Subscribes to ComponentChanged and SelectionChanged events. On move changes, resolves the nearest dock position. On resize changes, forwards to BeepDockingDesignerWiring.ResizeDockspace().
Window Message Handling
The designer overrides WndProc() to intercept three key Windows messages for tab drag-drop:
| Message | Behavior |
|---|---|
WM_LBUTTONDOWN | Detects if the click is on a tab header. If yes, initiates drag tracking by recording the source panel. |
WM_MOUSEMOVE | While dragging, tracks mouse position for potential drop target. |
WM_LBUTTONUP | Completes the drag: calls BeepDockingDesignerWiring.DropPanelAt() to place the panel at its new position. |
Examples
// At design time, the user can:
// 1. Click a tab header to select the corresponding DockPanel
// 2. Drag a tab header to reorder panels within the dockspace
// 3. Move the entire dockspace — it snaps to nearest edge
// 4. Resize the dockspace — adjacent panels recalculate
// At runtime, the dockspace is managed by BeepDockingManager:
dockspace.ActivatePanel(myPanel);
dockspace.SelectPage("my-panel-key");
var activePanel = dockspace.ActivePanel;