This document is archived and information here might be outdated.  Recommended version.


Creating dockable windows (ArcObjects .NET 10.4 SDK)

Creating dockable windows


Summary
This topic describes three ways to implement a custom dockable window: using add-ins, extending ArcObjects by manually implementing Component Object Model (COM) interfaces, and using the Dockable Window template in the ArcObjects .NET Software Development Kit (SDK).

In this topic


About dockable windows

Dockable windows are configurable windows in an application that present additional data typically related to the active view. For example, in ArcMap, the table of contents and the Catalog window are dockable windows. Dockable windows can be moved and docked within the application, or they can float. When docked, dockable windows can also be unpinned (tabbed or collapsed into the margins) to maximize application real estate.

Using add-ins

Creating an add-in is the easiest and recommended way to create a custom dockable window. See Building add-ins for ArcGIS for Desktop for information on using add-ins.

Extending ArcObjects

When extending ArcObjects, a custom dockable window is created by implementing IDockableWindowDef. When implementing this interface, you must provide a handle to a window that will ultimately be hosted by the application framework. This window is typically a UserControl, and you can use its Handle property to return the required HWND. As with commands, dockable windows are passed a reference to the host application inside OnCreate.
All dockable windows are discovered via component categories. For example, all ArcMap dockable windows must be registered in the MxDockableWindows component category.
Starting at ArcGIS 10, dockable windows can optionally implement IDockabeWindowImageDef and IDockableWindowInitialPlacement. IDockableWindowImageDef is used to define the image for the dockable window. This image appears when the dockable window is unpinned or grouped as shown in the following screen shot:
IDockabeWindowInitialPlacement establishes the window's initial representation including height, width, and dock position. This interface is only consulted the first time the window is displayed.

Using the Dockable Window template

A Dockable Window item template is available with the ArcObjects .NET SDK to help you quickly create a dockable window. The item template stubs out a new UserControl class that implements IDockableWindowDef. The item template wires up the ChildHWND property and writes the necessary COM registration code. In addition, the template creates a command that opens the dockable window. See the following screen shot showing the Dockable Window template option on the Add New Item dialog box:


See Also:

Sample: Simple logging dockable window with a custom context menu
Sample: Web browser dockable window
How to handle ActiveX controls embedded in a dockable window