Logo
HOWTO: Understanding toolwindow states in Visual Studio

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio .NET 2002
Date: May 2006   Microsoft Visual Studio .NET 2003
Updated: March 2013   Microsoft Visual Studio 2005
      Microsoft Visual Studio 2008
      Microsoft Visual Studio 2010
      Microsoft Visual Studio 2012
Introduction

Visual Studio provides two kinds of windows (apart from the main window of the IDE):

  • Document windows: these are the windows used to show the source code of a file or the designer of a form. Usually these windows appear tabbed inside the main window of the IDE (although it can be configured to appear as MDI child windows).
  • Toolwindows: these are auxiliary windows to provide some functionality in the IDE. For example, the Solution Explorer or the Properties window.

In turn, a toolwindow can be in three states:

  • Docked (or linked): they are attached to some edge of the main IDE. Usually this is the case of the Solution Explorer or the Properties window. Several docked toolwindows can appear together too (one of them hides the others), and in this case they show tabs (this is usually the case of the Solution Explorer and the Class View).
  • Floating: they appear over the main window, outside of it, floating on the screen. People use this state to move them to a secondary monitor to gain space in the main window.
  • Tabbed: they appear as if they were document windows, although they are still toolwindows. Usually this is the case of the Start Page or the Object Browser.

Notice that any toolwindow can be in any of those states. It just happens that some toolwindows are preset to appear in a specific state.

More Information

You can set the state of a toolwindow manually through the context menu of its caption, which offers at least the following menu entries:

  • Floating
  • Dockable

Notice that these two properties provide actually four and not three states as explained before, because a toolwindow can be floating even if the Floating menu entry is unchecked, as long as it is not docked.

You can also set the state of a toolwindow programmatically. This article assumes that you have already created a toolwindow using the EnvDTE.Windows.CreateToolwindow and that you already have the EnvDTE.Window object returned by that function (showing the code to create a toolwindow is beyond the scope of this article, see the article HOWTO: Create a dockable toolwindow from a Visual Studio .NET add-in).

The state of a toolwindow can be set programmatically through two properties of the EnvDTE.Window class:

  • IsFloating
  • Linkable

Notice that although the user interface uses the term "Dockable", the extensibility model uses the term "Linkable".

For example, to make a toolwindow to appear as a tabbed window, you have to set both properties to false.

Related articles



Go to the 'Visual Studio Extensibility (VSX)' web site for more articles like this (Articles section)