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.

Note

All tools windows in Visual Studio 10 are now WPF-based. This is different from previous versions of Visual Studio, which used Windows Forms tool windows. Visual Studio 10 can still load tool windows from previous versions, but creating new Windows Forms tool windows is not supported.

  • 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.

  • Tool windows are single-instance by default, meaning that only one instance of the tool window can be open at a time. To learn about multi-instance tool windows, see How to: Create a Multi-Instance Tool Window.

  • 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 WPF user controls and support toolbars. You can override the Window property to return the handle of the hosted control.

  • 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