Implementing Syncfusion WinForms Docking Manager
The DockingManager control implements an architecture that allows panels to be docked at any part of form, creating Visual Studio-style dockable windows. Dock panels can be interactively dragged, resized, floated, auto-hidden, tabbed, and arranged in complex layouts at runtime.
When to Use This Skill
Use this skill when you need to:
- Create Visual Studio-style docking layouts with dockable panels and windows
- Implement multiple dock states: docked, floating, auto-hide, tabbed, MDI, or TDI windows
- Build document-based applications with TDI (Tabbed Document Interface) or MDI (Multiple Document Interface)
- Add caption buttons (close, pin, menu, maximize) to docked windows
- Persist dock layouts across application sessions using serialization
- Handle dock events for activation, state changes, and user interactions
- Customize appearance with visual styles, themes, and colors
- Manage nested or linked docking managers for complex layouts
- Implement drag-and-drop docking with visual feedback and hints
Component Overview
DockingManager transforms any control into a fully-featured docking window with:
- Dock States: Docked (Left, Right, Top, Bottom), Floating, Auto-Hide, Tabbed, Fill
- Document Windows: TDI (Tabbed Documents) and MDI (Multiple Documents)
- Caption Buttons: Close, Pin (Auto-Hide), Menu, Maximize, Restore, and custom buttons
- Visual Styles: Metro, Office2016 (Colorful, White, DarkGray, Black), VS2010, Office2007/2010
- Serialization: Save/load dock state to XML, binary, memory stream, or isolated storage
- Events: 25+ events for dock state changes, activation, dragging, context menus
- Advanced Features: Nested managers, linked managers, dock restrictions, tab groups
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and assembly deployment
- Creating DockingManager instance
- Adding dock child windows with SetEnableDocking
- Setting dock labels and icons
- Basic docking setup and configuration
Dock States and Layouts
📄 Read: references/dock-states.md
- Dock state overview (Docked, Float, Auto-Hide, Tabbed, Fill)
- DockControl function to change states programmatically
- Setting dock sides (Left, Right, Top, Bottom, Tabbed)
- Detecting and managing dock states
- Dock ability restrictions
Document Windows (TDI/MDI)
📄 Read: references/document-windows.md
- TDI (Tabbed Document Interface) implementation
- MDI (Multiple Document Interface) setup
- EnableDocumentMode property
- DockAsDocument function for adding document tabs
- Window modes (Tool vs Document behavior)
- Creating and managing document tab groups
- Freezing document state
Caption Buttons and Customization
📄 Read: references/caption-buttons.md
- Default caption buttons (Close, Pin, Menu, Maximize, Restore)
- Show/hide specific buttons with Set/Get functions
- Adding custom caption buttons to CaptionButtons collection
- Button click handling and events
- Customizing button appearance and colors
- Button tooltips and SuperTooltips
Floating Windows
📄 Read: references/floating-windows.md
- Creating floating windows with FloatControl
- Floating by user drag interaction
- Enabling/disabling float functionality
- Floating window properties (border, size, location)
- Maximize floating windows
- Float-only windows (prevent re-docking)
- Show custom buttons in floating state
Auto-Hide Windows
📄 Read: references/auto-hide-windows.md
- Auto-hide functionality overview
- SetAutoHideMode function
- Auto-hide programmatically or by user pin button
- Changing auto-hide side with DockControlInAutoHideMode
- Auto-hide on load with SetAutoHideOnLoad
- Animation settings and speed
- Auto-hide tab customization
- Auto-hide selection style (MouseHover vs Click)
Tabbed Windows
📄 Read: references/tabbed-windows.md
- Tabbing windows together with Tabbed dock style
- Creating tab groups at design time and runtime
- Tab alignment options (Top, Bottom, Left, Right)
- Tab reordering with AllowTabsMoving
- Preventing tabbing with DockAbility
- Tab position management with Set/GetTabPosition
- Tab scroll buttons
Appearance and Visual Styles
📄 Read: references/appearance-customization.md
- Visual styles (Default, Metro, Office2016, VS2010, Office2007/2010)
- Office color schemes (Blue, Silver, Black, Managed)
- Custom colors for Office2007/2010
- Caption customization (background, foreground, font)
- Border colors and splitter customization
- Dock tab appearance (colors, fonts, height)
- Document tab styling
- Auto-hide tab styling
- Drag provider styles (VS2005, VS2008, VS2010, VS2012, Office2016)
- Right-to-left support
Serialization and State Persistence
📄 Read: references/serialization.md
- Auto serialization with PersistState property
- SaveDockState and LoadDockState functions
- Serialize to XML file
- Serialize to binary file
- Serialize to memory stream for database storage
- Serialize to isolated storage
- Serialize specific controls only
- Restore to designer initial state
Docking Events
📄 Read: references/docking-events.md
- DockControlActivated and DockControlDeactivated
- DockStateChanged and DockStateChanging
- AutoHideAnimationStart and AutoHideAnimationStop
- DragAllow, DragFeedbackStart, DragFeedbackStop
- DockContextMenu and AutoHideTabContextMenu
- ControlMaximizing, Maximized, Restored, Minimized
- DockVisibilityChanged and DockVisibilityChanging
- NewDockStateBeginLoad and NewDockStateEndLoad
- PreviewDockHints for restricting dock sides
- TabGroupCreating and TabGroupCreated
- TransferredToManager and TransferringFromManager
Advanced Features
📄 Read: references/advanced-features.md
- Nested docking managers (child manager within parent)
- Linked managers (drag between managers)
- Dock ability restrictions (SetDockAbility, SetOuterDockAbility)
- Size constraints (minimum size, freeze resizing)
- Prevent closing and docking operations
- Context menu customization (add/remove items)
- Splitter width and color customization
- Design-time docking features
- Localization support
Quick Start Example
Basic Docking Setup
using Syncfusion.Windows.Forms.Tools;
public partial class Form1 : Form
{
private DockingManager dockingManager1;
private Panel solutionExplorer;
private Panel toolbox;
private Panel properties;
private Panel output;
public Form1()
{
InitializeComponent();
// Create DockingManager
this.dockingManager1 = new DockingManager(this.components);
this.dockingManager1.HostControl = this;
// Create dock panels
this.solutionExplorer = new Panel();
this.toolbox = new Panel();
this.properties = new Panel();
this.output = new Panel();
// Add panels to form
this.Controls.AddRange(new Control[] {
solutionExplorer, toolbox, properties, output
});
// Enable docking for all panels
this.dockingManager1.SetEnableDocking(solutionExplorer, true);
this.dockingManager1.SetEnableDocking(toolbox, true);
this.dockingManager1.SetEnableDocking(properties, true);
this.dockingManager1.SetEnableDocking(output, true);
// Set dock labels
this.dockingManager1.SetDockLabel(solutionExplorer, "Solution Explorer");
this.dockingManager1.SetDockLabel(toolbox, "Toolbox");
this.dockingManager1.SetDockLabel(properties, "Properties");
this.dockingManager1.SetDockLabel(output, "Output");
// Arrange dock positions
this.dockingManager1.DockControl(solutionExplorer, this, DockingStyle.Right, 250);
this.dockingManager1.DockControl(toolbox, this, DockingStyle.Left, 200);
this.dockingManager1.DockControl(properties, solutionExplorer, DockingStyle.Tabbed, 200);
this.dockingManager1.DockControl(output, this, DockingStyle.Bottom, 150);
// Apply visual style
this.dockingManager1.VisualStyle = VisualStyle.Office2016Colorful;
}
}
Common Patterns
Creating Document Windows (TDI)
// Enable document mode
this.dockingManager1.EnableDocumentMode = true;
// Add document tabs in NewDockStateEndLoad event
this.dockingManager1.NewDockStateEndLoad += (s, e) =>
{
this.dockingManager1.DockAsDocument(document1);
this.dockingManager1.DockAsDocument(document2);
};
// Set window mode (Tool allows dock/float, Document allows float only)
this.dockingManager1.SetWindowMode(document1, WindowMode.Document);
Changing Dock States Programmatically
// Dock a control to specific side
this.dockingManager1.DockControl(panel1, this, DockingStyle.Left, 200);
// Float a control at specific location
Rectangle bounds = new Rectangle(100, 100, 300, 400);
this.dockingManager1.FloatControl(panel1, bounds);
// Auto-hide a control
this.dockingManager1.SetAutoHideMode(panel1, true);
// Tab control with another
this.dockingManager1.DockControl(panel2, panel1, DockingStyle.Tabbed, 200);
Customizing Caption Buttons
// Hide close button for specific control
this.dockingManager1.SetCloseButtonVisibility(panel1, false);
// Hide pin (auto-hide) button
this.dockingManager1.SetAutoHideButtonVisibility(panel1, false);
// Add custom caption button
CaptionButton customBtn = new CaptionButton();
customBtn.Name = "CustomButton";
customBtn.ImageIndex = 3; // From ImageList
customBtn.Type = CaptionButtonType.Custom;
this.dockingManager1.CaptionButtons.Add(customBtn);
// Customize button colors
this.dockingManager1.ActiveCaptionButtonForeColor = Color.Red;
this.dockingManager1.InActiveCaptionButtonForeColor = Color.Gray;
Serialization (Save/Load Layout)
using Syncfusion.Runtime.Serialization;
// Enable auto-save on close
this.dockingManager1.PersistState = true;
// Save to XML file manually
AppStateSerializer serializer = new AppStateSerializer(
SerializeMode.XMLFile, "DockLayout");
this.dockingManager1.SaveDockState(serializer);
serializer.PersistNow();
// Load from XML file
AppStateSerializer serializer = new AppStateSerializer(
SerializeMode.XMLFile, "DockLayout");
this.dockingManager1.LoadDockState(serializer);
// Save to memory stream (for database)
MemoryStream ms = new MemoryStream();
AppStateSerializer serializer = new AppStateSerializer(
SerializeMode.BinaryFmtStream, ms);
this.dockingManager1.SaveDockState(serializer);
serializer.PersistNow();
// Store ms.ToArray() in database
Handling Dock Events
// Track dock state changes
this.dockingManager1.DockStateChanged += (s, e) =>
{
foreach (Control ctrl in e.Controls)
{
Console.WriteLine($"{ctrl.Name} state changed");
}
};
// Prevent specific dock operations
this.dockingManager1.DockStateChanging += (s, e) =>
{
if (e.NewState == DockState.Float && e.Controls[0] == panel1)
{
e.Cancel = true; // Prevent panel1 from floating
}
};
// Handle control activation
this.dockingManager1.DockControlActivated += (s, e) =>
{
Console.WriteLine($"{e.Control.Name} activated");
};
// Restrict dock sides dynamically
this.dockingManager1.PreviewDockHints += (s, e) =>
{
if (e.DraggingTarget == panel2)
{
// Only allow right docking on panel2
e.DockAbility = DockAbility.Right;
}
};
Restricting Dock Abilities
// Restrict where control can dock (inner docking)
this.dockingManager1.SetDockAbility(panel1, DockAbility.Top | DockAbility.Bottom);
// Restrict where control can dock in client area (outer docking)
this.dockingManager1.SetOuterDockAbility(panel1,
DockAbility.Left | DockAbility.Right);
// Make control float-only (cannot re-dock)
this.dockingManager1.SetFloatOnly(panel1, true);
// Disable floating for specific control
this.dockingManager1.SetAllowFloating(panel1, false);
Customizing Appearance
// Set visual style
this.dockingManager1.VisualStyle = VisualStyle.Office2016Colorful;
// Customize active caption colors
this.dockingManager1.ActiveCaptionBackground = new BrushInfo(
GradientStyle.Horizontal, Color.DarkBlue, Color.LightBlue);
this.dockingManager1.ActiveCaptionForeGround = Color.White;
// Customize dock tab colors
this.dockingManager1.DockTabBackColor = Color.LightGray;
this.dockingManager1.ActiveDockTabBackColor = Color.White;
this.dockingManager1.DockTabForeColor = Color.Black;
// Customize document tab colors
this.dockingManager1.DocumentWindowSettings.TabBackColor = Color.SteelBlue;
this.dockingManager1.DocumentWindowSettings.ActiveTabBackColor = Color.Green;
this.dockingManager1.DocumentWindowSettings.TabHeight = 38;
// Set drag provider style
this.dockingManager1.DragProviderStyle = DragProviderStyle.VS2012;
Key Properties and Methods
Essential Properties
- HostControl: Gets/sets the parent control hosting the docking layout
- EnableDocumentMode: Enable TDI (Tabbed Document Interface) mode
- PersistState: Enable automatic save/load of dock state
- VisualStyle: Set appearance theme (Metro, Office2016, VS2010, etc.)
- DragProviderStyle: Set drag hint style (VS2005, VS2008, VS2010, VS2012)
- AutoHideEnabled: Enable/disable auto-hide (pin) functionality
- AllowTabsMoving: Enable tab reordering by drag-and-drop
- ShowCaption: Show/hide caption bar for all dock windows
- CaptionButtons: Collection of caption buttons (Close, Pin, Menu, etc.)
Essential Methods
Adding Dock Children:
SetEnableDocking(Control, bool): Enable docking for a control
SetDockLabel(Control, string): Set caption label text
SetDockIcon(Control, Icon): Set caption icon
Changing Dock States:
DockControl(Control, Control, DockingStyle, int): Dock control at specific side
FloatControl(Control, Rectangle): Float control at location
SetAutoHideMode(Control, bool): Set auto-hide state
SetAsMDIChild(Control, bool): Convert to MDI child window
DockAsDocument(Control): Add as TDI document tab
State Management:
GetDockStyle(Control): Get current dock style
IsFloating(Control): Check if control is floating
GetAutoHideMode(Control): Check if control is auto-hidden
IsMDIMode(Control): Check if control is MDI child
IsTabbed(Control): Check if control is tabbed
Serialization:
SaveDockState(): Save to isolated storage
SaveDockState(AppStateSerializer): Save to file/stream
LoadDockState(): Load from isolated storage
LoadDockState(AppStateSerializer): Load from file/stream
Caption Buttons:
SetCloseButtonVisibility(Control, bool): Show/hide close button
SetAutoHideButtonVisibility(Control, bool): Show/hide pin button
SetMenuButtonVisibility(Control, bool): Show/hide menu button
Restrictions:
SetDockAbility(Control, DockAbility): Restrict inner docking sides
SetOuterDockAbility(Control, DockAbility): Restrict outer docking sides
SetFloatOnly(Control, bool): Make control float-only
SetAllowFloating(Control, bool): Enable/disable floating
Common Use Cases
1. Visual Studio-Style IDE Layout
Create solution explorer, toolbox, properties, and output windows with docking, floating, and auto-hide capabilities.
2. Document Editing Application
Implement tabbed document interface (TDI) for multiple document editing with tool windows around the edges.
3. Dashboard Layout Manager
Build customizable dashboard with dockable widget panels that users can arrange and persist.
4. Multi-Panel Data Viewer
Display multiple data grids, charts, and details panels with flexible docking and tabbing.
5. Application with Persistent Layout
Save and restore user's preferred window arrangement across sessions using serialization.
6. MDI Application Modernization
Convert traditional MDI applications to modern docking interface with floating and tabbed documents.
7. Custom Development Tools
Build code editors, debuggers, or design tools with dockable windows similar to Visual Studio.
1---2name: syncfusion-winforms-docking-manager3description: Guide to implement Syncfusion WinForms DockingManager control for Visual Studio-style dockable windows and layouts. Use this when creating docked, floating, or tabbed windows with advanced layout management. Covers dock states, auto-hide functionality, caption customization, and serialization in WinForms applications.4---56# Implementing Syncfusion WinForms Docking Manager78The DockingManager control implements an architecture that allows panels to be docked at any part of form, creating Visual Studio-style dockable windows. Dock panels can be interactively dragged, resized, floated, auto-hidden, tabbed, and arranged in complex layouts at runtime.910## When to Use This Skill1112Use this skill when you need to:1314- **Create Visual Studio-style docking layouts** with dockable panels and windows15- **Implement multiple dock states**: docked, floating, auto-hide, tabbed, MDI, or TDI windows16- **Build document-based applications** with TDI (Tabbed Document Interface) or MDI (Multiple Document Interface)17- **Add caption buttons** (close, pin, menu, maximize) to docked windows18- **Persist dock layouts** across application sessions using serialization19- **Handle dock events** for activation, state changes, and user interactions20- **Customize appearance** with visual styles, themes, and colors21- **Manage nested or linked docking managers** for complex layouts22- **Implement drag-and-drop docking** with visual feedback and hints2324## Component Overview2526**DockingManager** transforms any control into a fully-featured docking window with:2728- **Dock States**: Docked (Left, Right, Top, Bottom), Floating, Auto-Hide, Tabbed, Fill29- **Document Windows**: TDI (Tabbed Documents) and MDI (Multiple Documents)30- **Caption Buttons**: Close, Pin (Auto-Hide), Menu, Maximize, Restore, and custom buttons31- **Visual Styles**: Metro, Office2016 (Colorful, White, DarkGray, Black), VS2010, Office2007/201032- **Serialization**: Save/load dock state to XML, binary, memory stream, or isolated storage33- **Events**: 25+ events for dock state changes, activation, dragging, context menus34- **Advanced Features**: Nested managers, linked managers, dock restrictions, tab groups3536## Documentation and Navigation Guide3738### Getting Started39📄 **Read:** [references/getting-started.md](references/getting-started.md)40- Installation and assembly deployment41- Creating DockingManager instance42- Adding dock child windows with SetEnableDocking43- Setting dock labels and icons44- Basic docking setup and configuration4546### Dock States and Layouts47📄 **Read:** [references/dock-states.md](references/dock-states.md)48- Dock state overview (Docked, Float, Auto-Hide, Tabbed, Fill)49- DockControl function to change states programmatically50- Setting dock sides (Left, Right, Top, Bottom, Tabbed)51- Detecting and managing dock states52- Dock ability restrictions5354### Document Windows (TDI/MDI)55📄 **Read:** [references/document-windows.md](references/document-windows.md)56- TDI (Tabbed Document Interface) implementation57- MDI (Multiple Document Interface) setup58- EnableDocumentMode property59- DockAsDocument function for adding document tabs60- Window modes (Tool vs Document behavior)61- Creating and managing document tab groups62- Freezing document state6364### Caption Buttons and Customization65📄 **Read:** [references/caption-buttons.md](references/caption-buttons.md)66- Default caption buttons (Close, Pin, Menu, Maximize, Restore)67- Show/hide specific buttons with Set/Get functions68- Adding custom caption buttons to CaptionButtons collection69- Button click handling and events70- Customizing button appearance and colors71- Button tooltips and SuperTooltips7273### Floating Windows74📄 **Read:** [references/floating-windows.md](references/floating-windows.md)75- Creating floating windows with FloatControl76- Floating by user drag interaction77- Enabling/disabling float functionality78- Floating window properties (border, size, location)79- Maximize floating windows80- Float-only windows (prevent re-docking)81- Show custom buttons in floating state8283### Auto-Hide Windows84📄 **Read:** [references/auto-hide-windows.md](references/auto-hide-windows.md)85- Auto-hide functionality overview86- SetAutoHideMode function87- Auto-hide programmatically or by user pin button88- Changing auto-hide side with DockControlInAutoHideMode89- Auto-hide on load with SetAutoHideOnLoad90- Animation settings and speed91- Auto-hide tab customization92- Auto-hide selection style (MouseHover vs Click)9394### Tabbed Windows95📄 **Read:** [references/tabbed-windows.md](references/tabbed-windows.md)96- Tabbing windows together with Tabbed dock style97- Creating tab groups at design time and runtime98- Tab alignment options (Top, Bottom, Left, Right)99- Tab reordering with AllowTabsMoving100- Preventing tabbing with DockAbility101- Tab position management with Set/GetTabPosition102- Tab scroll buttons103104### Appearance and Visual Styles105📄 **Read:** [references/appearance-customization.md](references/appearance-customization.md)106- Visual styles (Default, Metro, Office2016, VS2010, Office2007/2010)107- Office color schemes (Blue, Silver, Black, Managed)108- Custom colors for Office2007/2010109- Caption customization (background, foreground, font)110- Border colors and splitter customization111- Dock tab appearance (colors, fonts, height)112- Document tab styling113- Auto-hide tab styling114- Drag provider styles (VS2005, VS2008, VS2010, VS2012, Office2016)115- Right-to-left support116117### Serialization and State Persistence118📄 **Read:** [references/serialization.md](references/serialization.md)119- Auto serialization with PersistState property120- SaveDockState and LoadDockState functions121- Serialize to XML file122- Serialize to binary file123- Serialize to memory stream for database storage124- Serialize to isolated storage125- Serialize specific controls only126- Restore to designer initial state127128### Docking Events129📄 **Read:** [references/docking-events.md](references/docking-events.md)130- DockControlActivated and DockControlDeactivated131- DockStateChanged and DockStateChanging132- AutoHideAnimationStart and AutoHideAnimationStop133- DragAllow, DragFeedbackStart, DragFeedbackStop134- DockContextMenu and AutoHideTabContextMenu135- ControlMaximizing, Maximized, Restored, Minimized136- DockVisibilityChanged and DockVisibilityChanging137- NewDockStateBeginLoad and NewDockStateEndLoad138- PreviewDockHints for restricting dock sides139- TabGroupCreating and TabGroupCreated140- TransferredToManager and TransferringFromManager141142### Advanced Features143📄 **Read:** [references/advanced-features.md](references/advanced-features.md)144- Nested docking managers (child manager within parent)145- Linked managers (drag between managers)146- Dock ability restrictions (SetDockAbility, SetOuterDockAbility)147- Size constraints (minimum size, freeze resizing)148- Prevent closing and docking operations149- Context menu customization (add/remove items)150- Splitter width and color customization151- Design-time docking features152- Localization support153154## Quick Start Example155156### Basic Docking Setup157158```csharp159using Syncfusion.Windows.Forms.Tools;160161public partial class Form1 : Form162{163 private DockingManager dockingManager1;164 private Panel solutionExplorer;165 private Panel toolbox;166 private Panel properties;167 private Panel output;168169 public Form1()170 {171 InitializeComponent();172 173 // Create DockingManager174 this.dockingManager1 = new DockingManager(this.components);175 this.dockingManager1.HostControl = this;176 177 // Create dock panels178 this.solutionExplorer = new Panel();179 this.toolbox = new Panel();180 this.properties = new Panel();181 this.output = new Panel();182 183 // Add panels to form184 this.Controls.AddRange(new Control[] { 185 solutionExplorer, toolbox, properties, output 186 });187 188 // Enable docking for all panels189 this.dockingManager1.SetEnableDocking(solutionExplorer, true);190 this.dockingManager1.SetEnableDocking(toolbox, true);191 this.dockingManager1.SetEnableDocking(properties, true);192 this.dockingManager1.SetEnableDocking(output, true);193 194 // Set dock labels195 this.dockingManager1.SetDockLabel(solutionExplorer, "Solution Explorer");196 this.dockingManager1.SetDockLabel(toolbox, "Toolbox");197 this.dockingManager1.SetDockLabel(properties, "Properties");198 this.dockingManager1.SetDockLabel(output, "Output");199 200 // Arrange dock positions201 this.dockingManager1.DockControl(solutionExplorer, this, DockingStyle.Right, 250);202 this.dockingManager1.DockControl(toolbox, this, DockingStyle.Left, 200);203 this.dockingManager1.DockControl(properties, solutionExplorer, DockingStyle.Tabbed, 200);204 this.dockingManager1.DockControl(output, this, DockingStyle.Bottom, 150);205 206 // Apply visual style207 this.dockingManager1.VisualStyle = VisualStyle.Office2016Colorful;208 }209}210```211212## Common Patterns213214### Creating Document Windows (TDI)215216```csharp217// Enable document mode218this.dockingManager1.EnableDocumentMode = true;219220// Add document tabs in NewDockStateEndLoad event221this.dockingManager1.NewDockStateEndLoad += (s, e) =>222{223 this.dockingManager1.DockAsDocument(document1);224 this.dockingManager1.DockAsDocument(document2);225};226227// Set window mode (Tool allows dock/float, Document allows float only)228this.dockingManager1.SetWindowMode(document1, WindowMode.Document);229```230231### Changing Dock States Programmatically232233```csharp234// Dock a control to specific side235this.dockingManager1.DockControl(panel1, this, DockingStyle.Left, 200);236237// Float a control at specific location238Rectangle bounds = new Rectangle(100, 100, 300, 400);239this.dockingManager1.FloatControl(panel1, bounds);240241// Auto-hide a control242this.dockingManager1.SetAutoHideMode(panel1, true);243244// Tab control with another245this.dockingManager1.DockControl(panel2, panel1, DockingStyle.Tabbed, 200);246```247248### Customizing Caption Buttons249250```csharp251// Hide close button for specific control252this.dockingManager1.SetCloseButtonVisibility(panel1, false);253254// Hide pin (auto-hide) button255this.dockingManager1.SetAutoHideButtonVisibility(panel1, false);256257// Add custom caption button258CaptionButton customBtn = new CaptionButton();259customBtn.Name = "CustomButton";260customBtn.ImageIndex = 3; // From ImageList261customBtn.Type = CaptionButtonType.Custom;262this.dockingManager1.CaptionButtons.Add(customBtn);263264// Customize button colors265this.dockingManager1.ActiveCaptionButtonForeColor = Color.Red;266this.dockingManager1.InActiveCaptionButtonForeColor = Color.Gray;267```268269### Serialization (Save/Load Layout)270271```csharp272using Syncfusion.Runtime.Serialization;273274// Enable auto-save on close275this.dockingManager1.PersistState = true;276277// Save to XML file manually278AppStateSerializer serializer = new AppStateSerializer(279 SerializeMode.XMLFile, "DockLayout");280this.dockingManager1.SaveDockState(serializer);281serializer.PersistNow();282283// Load from XML file284AppStateSerializer serializer = new AppStateSerializer(285 SerializeMode.XMLFile, "DockLayout");286this.dockingManager1.LoadDockState(serializer);287288// Save to memory stream (for database)289MemoryStream ms = new MemoryStream();290AppStateSerializer serializer = new AppStateSerializer(291 SerializeMode.BinaryFmtStream, ms);292this.dockingManager1.SaveDockState(serializer);293serializer.PersistNow();294// Store ms.ToArray() in database295```296297### Handling Dock Events298299```csharp300// Track dock state changes301this.dockingManager1.DockStateChanged += (s, e) =>302{303 foreach (Control ctrl in e.Controls)304 {305 Console.WriteLine($"{ctrl.Name} state changed");306 }307};308309// Prevent specific dock operations310this.dockingManager1.DockStateChanging += (s, e) =>311{312 if (e.NewState == DockState.Float && e.Controls[0] == panel1)313 {314 e.Cancel = true; // Prevent panel1 from floating315 }316};317318// Handle control activation319this.dockingManager1.DockControlActivated += (s, e) =>320{321 Console.WriteLine($"{e.Control.Name} activated");322};323324// Restrict dock sides dynamically325this.dockingManager1.PreviewDockHints += (s, e) =>326{327 if (e.DraggingTarget == panel2)328 {329 // Only allow right docking on panel2330 e.DockAbility = DockAbility.Right;331 }332};333```334335### Restricting Dock Abilities336337```csharp338// Restrict where control can dock (inner docking)339this.dockingManager1.SetDockAbility(panel1, DockAbility.Top | DockAbility.Bottom);340341// Restrict where control can dock in client area (outer docking)342this.dockingManager1.SetOuterDockAbility(panel1, 343 DockAbility.Left | DockAbility.Right);344345// Make control float-only (cannot re-dock)346this.dockingManager1.SetFloatOnly(panel1, true);347348// Disable floating for specific control349this.dockingManager1.SetAllowFloating(panel1, false);350```351352### Customizing Appearance353354```csharp355// Set visual style356this.dockingManager1.VisualStyle = VisualStyle.Office2016Colorful;357358// Customize active caption colors359this.dockingManager1.ActiveCaptionBackground = new BrushInfo(360 GradientStyle.Horizontal, Color.DarkBlue, Color.LightBlue);361this.dockingManager1.ActiveCaptionForeGround = Color.White;362363// Customize dock tab colors364this.dockingManager1.DockTabBackColor = Color.LightGray;365this.dockingManager1.ActiveDockTabBackColor = Color.White;366this.dockingManager1.DockTabForeColor = Color.Black;367368// Customize document tab colors369this.dockingManager1.DocumentWindowSettings.TabBackColor = Color.SteelBlue;370this.dockingManager1.DocumentWindowSettings.ActiveTabBackColor = Color.Green;371this.dockingManager1.DocumentWindowSettings.TabHeight = 38;372373// Set drag provider style374this.dockingManager1.DragProviderStyle = DragProviderStyle.VS2012;375```376377## Key Properties and Methods378379### Essential Properties380381- **HostControl**: Gets/sets the parent control hosting the docking layout382- **EnableDocumentMode**: Enable TDI (Tabbed Document Interface) mode383- **PersistState**: Enable automatic save/load of dock state384- **VisualStyle**: Set appearance theme (Metro, Office2016, VS2010, etc.)385- **DragProviderStyle**: Set drag hint style (VS2005, VS2008, VS2010, VS2012)386- **AutoHideEnabled**: Enable/disable auto-hide (pin) functionality387- **AllowTabsMoving**: Enable tab reordering by drag-and-drop388- **ShowCaption**: Show/hide caption bar for all dock windows389- **CaptionButtons**: Collection of caption buttons (Close, Pin, Menu, etc.)390391### Essential Methods392393**Adding Dock Children:**394- `SetEnableDocking(Control, bool)`: Enable docking for a control395- `SetDockLabel(Control, string)`: Set caption label text396- `SetDockIcon(Control, Icon)`: Set caption icon397398**Changing Dock States:**399- `DockControl(Control, Control, DockingStyle, int)`: Dock control at specific side400- `FloatControl(Control, Rectangle)`: Float control at location401- `SetAutoHideMode(Control, bool)`: Set auto-hide state402- `SetAsMDIChild(Control, bool)`: Convert to MDI child window403- `DockAsDocument(Control)`: Add as TDI document tab404405**State Management:**406- `GetDockStyle(Control)`: Get current dock style407- `IsFloating(Control)`: Check if control is floating408- `GetAutoHideMode(Control)`: Check if control is auto-hidden409- `IsMDIMode(Control)`: Check if control is MDI child410- `IsTabbed(Control)`: Check if control is tabbed411412**Serialization:**413- `SaveDockState()`: Save to isolated storage414- `SaveDockState(AppStateSerializer)`: Save to file/stream415- `LoadDockState()`: Load from isolated storage416- `LoadDockState(AppStateSerializer)`: Load from file/stream417418**Caption Buttons:**419- `SetCloseButtonVisibility(Control, bool)`: Show/hide close button420- `SetAutoHideButtonVisibility(Control, bool)`: Show/hide pin button421- `SetMenuButtonVisibility(Control, bool)`: Show/hide menu button422423**Restrictions:**424- `SetDockAbility(Control, DockAbility)`: Restrict inner docking sides425- `SetOuterDockAbility(Control, DockAbility)`: Restrict outer docking sides426- `SetFloatOnly(Control, bool)`: Make control float-only427- `SetAllowFloating(Control, bool)`: Enable/disable floating428429## Common Use Cases430431### 1. Visual Studio-Style IDE Layout432Create solution explorer, toolbox, properties, and output windows with docking, floating, and auto-hide capabilities.433434### 2. Document Editing Application435Implement tabbed document interface (TDI) for multiple document editing with tool windows around the edges.436437### 3. Dashboard Layout Manager438Build customizable dashboard with dockable widget panels that users can arrange and persist.439440### 4. Multi-Panel Data Viewer441Display multiple data grids, charts, and details panels with flexible docking and tabbing.442443### 5. Application with Persistent Layout444Save and restore user's preferred window arrangement across sessions using serialization.445446### 6. MDI Application Modernization447Convert traditional MDI applications to modern docking interface with floating and tabbed documents.448449### 7. Custom Development Tools450Build code editors, debuggers, or design tools with dockable windows similar to Visual Studio.