In This Article

ToolWindow Class

Represents a tool window.

public class ToolWindow : DockingWindow, IDockTarget
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl DockingWindow object
Implements:
IDockTarget

Constructors

ToolWindow()

Initializes a new instance of the ToolWindow class. When creating instances of ToolWindow programmatically, use a constructor that accepts a DockSite instead.

public ToolWindow()

ToolWindow(DockSite)

Initializes a new instance of the ToolWindow class.

public ToolWindow(DockSite dockSite)
Parameter Type Description
dockSite DockSite

The DockSite with which to register this window.

ToolWindow(DockSite, string, string, ImageSource, object)

Initializes a new instance of the ToolWindow class.

public ToolWindow(DockSite dockSite, string serializationId, string title, ImageSource imageSource, object content)
Parameter Type Description
dockSite DockSite

The DockSite with which to register this window.

serializationId string

The serialization ID of the window, used during layout serialization.

title string

The title of the window.

imageSource ImageSource

The image source for the window's icon.

content object

The content of the window.

ToolWindow(bool)

Initializes a new instance of the ToolWindow class.

public ToolWindow(bool isContainerForItem)
Parameter Type Description
isContainerForItem bool

Whether the window is a container for an item.

Properties

AutoHideCommand

Gets the ICommand that can move the window into an auto-hide state.

public ICommand AutoHideCommand { get; }

Property Value

ICommand:

The ICommand that can move the window into an auto-hide state.

AutoHideTabContextContentTemplate

Gets or sets the DataTemplate containing contextual content that should be rendered in an auto-hide tab for this window.

public DataTemplate AutoHideTabContextContentTemplate { get; set; }

Property Value

DataTemplate:

The DataTemplate containing contextual content that should be rendered in an auto-hide tab for this window.

CanAutoHide

Gets or sets whether the tool window may be placed in auto-hide mode.

public bool? CanAutoHide { get; set; }

Property Value

bool?:

A nullable bool that indicates whether the tool window may be placed in auto-hide mode.

Remarks

If set to null, the resolved value will use the global DockSite setting.

CanAutoHideResolved

Gets a resolved value indicating whether the tool window may be placed in auto-hide mode.

public bool CanAutoHideResolved { get; }

Property Value

bool:

true if the tool window may be placed in auto-hide mode; otherwise, false.

CanBecomeDocument

Gets or sets whether the tool window may be placed in a document state.

public bool? CanBecomeDocument { get; set; }

Property Value

bool?:

A nullable bool that indicates whether the tool window may be placed in a document state.

Remarks

If set to null, the resolved value will use the global DockSite setting.

ContainerAutoHideSize

Gets or sets the System.Windows.Size of the tool window's container when it is in an auto-hide state.

public Size ContainerAutoHideSize { get; set; }

Property Value

Size:

The System.Windows.Size of the tool window's container when it is in an auto-hide state.

Remarks

The container is a ToolWindowContainer.

DefaultDockSide

Gets or sets the default Side that the tool window will dock towards when no prior location is known.

public Side DefaultDockSide { get; set; }

Property Value

Side:

The default Side that the tool window will dock towards when no prior location is known. The default value is Right.

DockCommand

Gets the ICommand that can move the window into a docked state.

public ICommand DockCommand { get; }

Property Value

ICommand:

The ICommand that can move the window into a docked state.

HasOptionsButton

Gets or sets whether the tool window displays an options button in its ToolWindowContainer title bar.

public bool? HasOptionsButton { get; set; }

Property Value

bool?:

A nullable bool that indicates whether the tool window displays an options button in its ToolWindowContainer title bar.

Remarks

If set to null, the resolved value will use the global DockSite setting. If this value resolves to true then the window will display a drop-down menu button.

HasOptionsButtonResolved

Gets a resolved value indicating whether the tool window displays an options button in its ToolWindowContainer title bar.

public bool HasOptionsButtonResolved { get; }

Property Value

bool:

true if the tool window displays an options button in its ToolWindowContainer title bar; otherwise, false.

HasTitleBar

Gets or sets whether the tool window displays a title bar in its parent ToolWindowContainer.

public bool? HasTitleBar { get; set; }

Property Value

bool?:

A nullable bool that indicates whether the tool window displays a title bar in its parent ToolWindowContainer.

Remarks

If set to null, the resolved value will use the global DockSite setting.

HasTitleBarResolved

Gets a resolved value indicating whether the tool window displays a title bar in its parent ToolWindowContainer.

public bool HasTitleBarResolved { get; }

Property Value

bool:

true if the tool window displays a title bar in its parent ToolWindowContainer; otherwise, false.

IsAutoHidePopupOpen

Gets whether the tool window is currently visible within an auto-hide popup.

public bool IsAutoHidePopupOpen { get; }

Property Value

bool:

true if the tool window is currently visible within an auto-hide popup; otherwise, false. The default value is false.

Remarks

This property is only true when the tool window is an auto-hide State and it is the AutoHidePopupToolWindow in the containing dock host.

ToolWindowContainerTabContextContentTemplate

Gets or sets the DataTemplate containing contextual content that should be rendered in a tool window container's tab for this tool window.

public DataTemplate ToolWindowContainerTabContextContentTemplate { get; set; }

Property Value

DataTemplate:

The DataTemplate containing contextual content that should be rendered in a tool window container's tab for this tool window.

ToolWindowContainerTitleBarContextContentTemplate

Gets or sets the DataTemplate containing contextual content that should be rendered in a tool window container's title bar when this tool window is active.

public DataTemplate ToolWindowContainerTitleBarContextContentTemplate { get; set; }

Property Value

DataTemplate:

The DataTemplate containing contextual content that should be rendered in a tool window container's title bar when this tool window is active.

Methods

Attach(IDockTarget)

Attaches the ToolWindow to the specified target, generally making a tabbed group.

public void Attach(IDockTarget target)
Parameter Type Description
target IDockTarget

The IDockTarget against which to attach.

Remarks

The target can be another docking window, TabbedMdiContainer, or ToolWindowContainer. Use the Dock(IDockTarget, Side) method to dock to the side of the target instead.

AutoHide()

Auto-hides the ToolWindow to the closest outer-edge of the ancestor DockHost.

public void AutoHide()

Remarks

Using this method places the ToolWindow in an AutoHideState. Use the AutoHide(Side) method overload to auto-hide to a specific side.

AutoHide(Side)

Auto-hides the ToolWindow to the specified outer-edge of the ancestor DockHost.

public void AutoHide(Side side)
Parameter Type Description
side Side

A Side indicating the side upon which to auto-hide.

Remarks

Using this method places the ToolWindow in an AutoHideState. Use the AutoHide() method overload to auto-hide to the control's default side.

Dock()

Docks the ToolWindow back to its default docked location.

public void Dock()

Remarks

Using this method places the ToolWindow in a DockedState. If the tool window isn't currently open or isn't in a Docked state, it will attempt to restore to the previous docked location. If one isn't available, a default docked location will be selected based on WindowGroupName, DefaultLocationRequested, and DefaultDockSide.

Dock(IDockTarget, Side)

Docks the ToolWindow to the side of a specified target.

public void Dock(IDockTarget target, Side side)
Parameter Type Description
target IDockTarget

The IDockTarget that is the target of the dock.

side Side

The target's Side against which to dock.

Remarks

Use the Dock() method overload to dock back to its previous docked location. Use the Attach(IDockTarget) method to dock into a particular target.

Float(Point?, Size?)

Floats the ToolWindow to the specified optional location and size.

public override void Float(Point? location, Size? size)
Parameter Type Description
location Point?

An optional System.Windows.Point specifying the target location of the floating dock host.

size Size?

An optional System.Windows.Size specifying the target size of the floating dock host.

Remarks

When location is not specified, it will float to a default location. When size is not specified, it will float with its current size. Using this method places the ToolWindow in a DockedState within a floating dock host.

GetCurrentSide()

Returns a Side indicating where the tool window is located, if it is currently open.

public Side? GetCurrentSide()

Returns

Side?:

A Side indicating where the tool window is located, if it is currently open.

Remarks

If the tool window is open in a Document state, null is returned. If the tool window is open in an AutoHide state, the auto-hide dock Side is returned. If the tool window is open in a Docked state and the containing dock host has a workspace (no tool window inner-fill), a Side indicating the location of the tool window relative to the workspace is returned. If the tool window is open in a Docked state and the containing dock host does not has a workspace (tool window inner-fill is active), a Side indicating the location of the tool window's midpoint relative to the dock host's bounds is returned. Otherwise, if the tool window is closed, null is returned.

OnCreateAutomationPeer()

Returns an AutomationPeer object for this control instance.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

An AutomationPeer instance.

OnDockSiteChanged(DockSite, DockSite)

Occurs when the value of the DockSite property has changed.

protected override void OnDockSiteChanged(DockSite oldValue, DockSite newValue)
Parameter Type Description
oldValue DockSite

The old value.

newValue DockSite

The new value.

OnStateChanged(DockingWindowState, DockingWindowState)

Occurs when the value of the State property has changed.

protected override void OnStateChanged(DockingWindowState oldValue, DockingWindowState newValue)
Parameter Type Description
oldValue DockingWindowState

The old value.

newValue DockingWindowState

The new value.

ToString()

Returns a String that represents the current Object.

public override string ToString()

Returns

string:

A String that represents the current Object.

UpdateCanAttachResolved()

Updates the CanAttachResolved value.

protected override void UpdateCanAttachResolved()

UpdateCanBecomeDocumentResolved()

Updates the CanBecomeDocumentResolved value.

protected override void UpdateCanBecomeDocumentResolved()

UpdateCanCloseResolved()

Updates the CanCloseResolved value.

protected override void UpdateCanCloseResolved()

UpdateCanDockResolved()

Updates the CanDockResolved value.

protected override void UpdateCanDockResolved()

UpdateCanDragTabResolved()

Updates the CanDragTabResolved value.

protected override void UpdateCanDragTabResolved()

UpdateCanDragToLinkedDockSitesResolved()

protected override void UpdateCanDragToLinkedDockSitesResolved()

UpdateCanFloatResolved()

Updates the CanFloatResolved value.

protected override void UpdateCanFloatResolved()

UpdateCommands()

Updates the enabled states of the commands.

protected override void UpdateCommands()

Fields

AutoHideTabContextContentTemplateProperty

Identifies the AutoHideTabContextContentTemplate dependency property. This field is read-only.

public static readonly DependencyProperty AutoHideTabContextContentTemplateProperty

CanAutoHideProperty

Identifies the CanAutoHide dependency property. This field is read-only.

public static readonly DependencyProperty CanAutoHideProperty

CanAutoHideResolvedProperty

Identifies the CanAutoHideResolved dependency property. This field is read-only.

public static readonly DependencyProperty CanAutoHideResolvedProperty

CanBecomeDocumentProperty

Identifies the CanBecomeDocument dependency property. This field is read-only.

public static readonly DependencyProperty CanBecomeDocumentProperty

ContainerAutoHideSizeProperty

Identifies the ContainerAutoHideSize dependency property. This field is read-only.

public static readonly DependencyProperty ContainerAutoHideSizeProperty

DefaultDockSideProperty

Identifies the DefaultDockSide dependency property. This field is read-only.

public static readonly DependencyProperty DefaultDockSideProperty

HasOptionsButtonProperty

Identifies the HasOptionsButton dependency property. This field is read-only.

public static readonly DependencyProperty HasOptionsButtonProperty

HasOptionsButtonResolvedProperty

Identifies the HasOptionsButtonResolved dependency property. This field is read-only.

public static readonly DependencyProperty HasOptionsButtonResolvedProperty

HasTitleBarProperty

Identifies the HasTitleBar dependency property. This field is read-only.

public static readonly DependencyProperty HasTitleBarProperty

HasTitleBarResolvedProperty

Identifies the HasTitleBarResolved dependency property. This field is read-only.

public static readonly DependencyProperty HasTitleBarResolvedProperty

IsAutoHidePopupOpenProperty

Identifies the IsAutoHidePopupOpen dependency property. This field is read-only.

public static readonly DependencyProperty IsAutoHidePopupOpenProperty

ToolWindowContainerTabContextContentTemplateProperty

Identifies the ToolWindowContainerTabContextContentTemplate dependency property. This field is read-only.

public static readonly DependencyProperty ToolWindowContainerTabContextContentTemplateProperty

ToolWindowContainerTitleBarContextContentTemplateProperty

Identifies the ToolWindowContainerTitleBarContextContentTemplate dependency property. This field is read-only.

public static readonly DependencyProperty ToolWindowContainerTitleBarContextContentTemplateProperty

Inherited Members