Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Collapse]Docking Library
   [Expand]Panels and Panel Containers
    Header Buttons
   [Collapse]Managing Dock Panels in Code
     Creating and Destroying Dock Panels
     Showing and Hiding Dock Panels
     Docking Panels Programmatically
     Controlling Dock Operations
     Controlling Resizing Operations
    Saving and Restoring the Layout of Dock Panels
   [Expand]Examples
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Controlling Dock Operations

This document describes how to respond to dock operations and cancel or disable them if necessary.

Expanded Disabling Dock Operations

Dock panels provide the DockPanel.Options property which contains a set of options to control dock operations on panels:

Option Description
DockPanelOptions.AllowDockBottom Specifies whether the dock panel can be docked to the bottom edge of a form (or user control).
DockPanelOptions.AllowDockFill Specifies whether the dock panel can be docked to another dock panel.
DockPanelOptions.AllowDockLeft Specifies whether the dock panel can be docked to the left edge of a form (or user control).
DockPanelOptions.AllowDockRight Specifies whether the dock panel can be docked to the right edge of a form (or user control).
DockPanelOptions.AllowDockTop Specifies whether the dock panel can be docked to the top edge of a form (or user control).
DockPanelOptions.AllowFloating Specifies whether the dock panel can be floated.
These options allow you to prevent a panel from being docked at a specific position. However, they don't provide full control of the docking functionality. For instance, even if a panel's DockPanelOptions.AllowDockBottom option is set to false, this panel can still be docked to another panel which is docked to the bottom edge of the form. To resolve this problem, set the panel's DockPanelOptions.AllowDockFill option to false to prevent it from being docked to other panels, or handle the DockManager.Docking event. This event provides more flexibility to manage dock operations.

Expanded Responding to Dock Operations Performed by end-users

Unlike options described above, events provide full control over dock operations. The dock manager provides the following events that fire in response to dock operations being performed by end-users against dock panels, and these can be handled to implement your custom logic.

  • DockManager.StartDocking

    Fires when an end-user starts to drag a panel. This event can be handled to cancel the dragging operation, if required.

  • DockManager.Docking

    Fires when a panel is being hovered over a dock control (another panel or form), to which this panel will be docked if it's dropped at its current position. The potential position of the panel within the target dock control is indicated with the frame. This event can be handled to prevent a panel from being docked to another panel (form), etc.

  • DockManager.EndDocking

    Fires after the dock operation has been successfully completed or canceled. An end-user can cancel a dock operation by pressing the ESC key during dragging. This event only serves to provide a notification.

By default, an end-user can double-click any docked panel's caption to float it. A subsequent double-click on the floating panel's caption will restore it to its previous position. This feature can be disabled for all the panels by setting the dock manager's BaseDockOptions.FloatOnDblClick option to false. To disable this feature for a specific panel, set the panel's FloatOnDblClick option to false.

Expanded Example

The following example demonstrates how to prevent panels from being dragged from containers and from being docked to other panels. This also prevents end-users from destroying the existing container panels. The DockManager.StartDocking and DockManager.Docking events are handled to restrict the dock operations.

Expanded See Also

How would you rate this topic?​​​​​​​