In This Article

Docking Window Events

There are a number of events to which you can attach to know when various actions occur to docking windows.

DockSite Events

The DockSite that owns the docking window receiving an action has these events:

Member Description
FloatingWindowOpening Event Occurs when a floating window is opening, allowing for customization before it is displayed.
MdiKindChanged Event Occurs when the DockSite.MdiKind property is changed.
MenuOpening Event Occurs when a docking-related context menu is opening, allowing for customization before it is displayed.
NewWindowRequested Event Occurs when a new DockingWindow is requested, generally via a user click on a New Tab button.
PrimaryDocumentChanged Event Occurs when the DockSite.PrimaryDocument property has changed.
WindowActivated Event Occurs after a DockingWindow has been activated.
WindowAutoHidePopupClosed Event Occurs after an auto-hide popup has been closed that displayed a ToolWindow.
WindowAutoHidePopupOpened Event Occurs after an auto-hide popup has been opened that displays a ToolWindow.
WindowDeactivated Event Occurs after a DockingWindow has been deactivated.
WindowDefaultLocationRequested Event Occurs when a DockingWindow's default location is requested.
WindowRegistered Event Occurs after a DockingWindow has been registered.
WindowsAutoHiding Event Occurs before one or more DockingWindow controls are auto-hidden, allowing for side customization.
WindowsClosed Event Occurs after one or more DockingWindow controls have been closed.
WindowsClosing Event Occurs before one or more DockingWindow controls are closed, allowing for cancellation of the close.
WindowsDockHostChanged Event Occurs after one or more DockingWindow controls' DockHost properties have changed.
WindowsDragged Event Occurs after one or more DockingWindow controls are dragged by the end user.
WindowsDragging Event Occurs before one or more DockingWindow controls are dragged by the end user.
WindowsDragOver Event Occurs when one or more docking windows are dragged over a new dock target, allowing for certain dock guides to be hidden.
WindowsOpened Event Occurs after one or more DockingWindow controls have been opened.
WindowsOpening Event Occurs before one or more DockingWindow controls is opened.
WindowsStateChanged Event Occurs after one or more DockingWindow controls' states have changed.
WindowUnregistered Event Occurs after a DockingWindow has been unregistered.

Most of the event arguments pass references to the related DockingWindow controls.

Displaying a StatusBar Message During Drags

It is a common practice to display a status bar message during tool window drags to indicate to the end user that they can move over the dock guides to docks a tool window.

To accomplish this, handle the WindowsDragging and display a message like this in your status bar:

Use the guide diamond to choose a docking location. To prevent docking, hold down CTRL.

Handle the WindowsDragged event and restore the status bar message back to something like Ready.

Customizing Menus

The MenuOpening event is raised before any menu is displayed for a window or button, allowing you to customize it or replace it with your own.

See the Menu Customization topic for details on handling this event.