Tool Window Essentials

Tools windows are child windows of the Visual Studio integrated development environment (IDE) that are used to display information. The Toolbox, Solution Explorer, Properties window, and Web Browser are examples of tool windows provided by the IDE.

  • Tool windows typically do not have associated documents. For more information about how to associate a document with a window, see Document Windows.

  • Tool windows are typically created or opened by clicking a menu command. To create a tool window programmatically, see How to: Open a Tool Window Programmatically (C#).

  • After a single-instance tool window is opened, it remains open until the IDE is closed. Therefore, when you click the close button on a single-instance tool window, only its visibility changes.

  • Tool windows have frames and client areas. The frame is provided by the IDE and is used to control the size, location, docking state, and other persistent properties. The client area, or pane, displays the tool window contents.

  • Tool window panes can host .NET user controls and support toolbars. You can override the Window property to return the handle of the hosted control.

    Note

    The Visual Studio SDK does not natively support Windows Presentation Foundation (WPF) user controls. To add a WPF user control in a Visual Studio tool window, use the ElementHost class to host the WPF user control in a Windows Forms user control. For an example of a WPF user control hosted in a tool window, see Walkthrough: Hosting a WPF User Control in a Tool Window.

  • Tool window panes can subscribe to window events like OnShow, OnMove, OnSize, and so on.

  • A VSPackage that provides tool windows registers each tool window with Visual Studio, together with its default size and location. For more information, see Registering Tool Windows.

    Note

    Default size and location apply only when the tool window is first opened. Thereafter, the tool window state is persisted by Visual Studio.

  • Tool windows can be docked, floating, or tabbed in the document frame.

  • Tool windows can be dynamic (also known as auto-visible). In this state, the tool window is visible whenever the user interface (UI) context to which the window is assigned applies. The use of auto-visibility can reduce the clutter of windows in the IDE. For more information, see How to: Open a Dynamic Tool Window.

Note

VSPackages are not the only way to create a tool window. Add-ins can create a tool window by using the Visual Studio Automation model.

See Also

Other Resources

Tool Windows

Change History

Date

History

Reason

July 2008

Added a note about how to host WPF controls in a tool window.

Content bug fix.