In This Article

ToolWindowContainer Class

Represents a container of one or more tool windows.

[TemplatePart(Name = "PART_Icon", Type = typeof(Control))]
[TemplatePart(Name = "PART_OptionsButton", Type = typeof(Button))]
[TemplatePart(Name = "PART_TitleBar", Type = typeof(Control))]
[PseudoClasses(new string[] { ":titlebar" })]
public class ToolWindowContainer : DockingWindowContainerBase, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IDockTarget, IOrientedElement
Inheritance:
object AvaloniaObject Animatable StyledElement Visual Layoutable Interactive InputElement Control TemplatedControl DockingWindowContainerBase object
Implements:
IDataContextProvider ILogical IThemeVariantHost IResourceHost IResourceNode IStyleHost ISetLogicalParent ISetInheritanceParent IStyleable INamed IInputElement IDataTemplateHost ISetterValue IDockTarget IOrientedElement

Constructors

ToolWindowContainer()

Initialize an instance of the class.

public ToolWindowContainer()

Properties

AutoHideCommand

The ICommand that can auto-hide the windows in the container.

public ICommand AutoHideCommand { get; }

Property Value

ICommand

CloseButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the close button content.

public IDataTemplate? CloseButtonContentTemplate { get; set; }

Property Value

IDataTemplate

CloseCommand

The ICommand that can close the windows in the container.

public ICommand CloseCommand { get; }

Property Value

ICommand

CloseKeyGesture

The Avalonia.Input.KeyGesture that is used to invoke the Close() method by default.

public KeyGesture? CloseKeyGesture { get; set; }

Property Value

KeyGesture:

The default value is Shift+Esc.

See Also

DockCommand

The ICommand that can dock the windows in the container.

public ICommand DockCommand { get; }

Property Value

ICommand

EmbeddedButtonTheme

The Avalonia.Styling.ControlTheme to use for embedded buttons.

public ControlTheme? EmbeddedButtonTheme { get; set; }

Property Value

ControlTheme

HasCloseButton

Indicates whether the container has a title bar close button if the SelectedWindow is closable.

public bool HasCloseButton { get; set; }

Property Value

bool:

The default value is true.

HasTitleBarGripper

Indicates whether the titlebar has a gripper.

public bool HasTitleBarGripper { get; set; }

Property Value

bool:

The default value is false.

HasTitleBarIcon

Indicates whether the container is capable of displaying the selected window's icon in the title bar.

public bool HasTitleBarIcon { get; set; }

Property Value

bool:

The default value is false.

HasToggleAutoHideButton

Indicates whether the container has a title bar toggle auto-hide button if the SelectedWindow can auto-hide.

public bool HasToggleAutoHideButton { get; set; }

Property Value

bool:

The default value is true.

IsCloseButtonVisible

Indicates whether the container's close button is visible.

public bool IsCloseButtonVisible { get; }

Property Value

bool:

The default value is true.

IsMaximizeButtonVisible

Indicates whether the container's maximize button is visible.

public bool IsMaximizeButtonVisible { get; }

Property Value

bool:

The default value is false.

IsMinimizeButtonVisible

Indicates whether the container's minimize button is visible.

public bool IsMinimizeButtonVisible { get; }

Property Value

bool:

The default value is false.

IsOptionsButtonVisible

Indicates whether the container's options button is visible.

public bool IsOptionsButtonVisible { get; }

Property Value

bool:

The default value is true.

IsRestoreButtonVisible

Indicates whether the container's restore button is visible.

public bool IsRestoreButtonVisible { get; }

Property Value

bool:

The default value is false.

IsToggleAutoHideButtonVisible

Indicates whether the container's toggle auto-hide button is visible.

public bool IsToggleAutoHideButtonVisible { get; }

Property Value

bool:

The default value is true.

MaximizeButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the maximize button content.

public IDataTemplate? MaximizeButtonContentTemplate { get; set; }

Property Value

IDataTemplate

MaximizeCommand

The ICommand that can maximize the window that hosts the container.

public ICommand MaximizeCommand { get; }

Property Value

ICommand

MenuButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the drop-down menu button content.

public IDataTemplate? MenuButtonContentTemplate { get; set; }

Property Value

IDataTemplate

MinimizeButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the minimize button content.

public IDataTemplate? MinimizeButtonContentTemplate { get; set; }

Property Value

IDataTemplate

MinimizeCommand

The ICommand that can minimize the window that hosts the container.

public ICommand MinimizeCommand { get; }

Property Value

ICommand

OpenOptionsMenuKeyGesture

The Avalonia.Input.KeyGesture that is used to invoke the OpenOptionsMenu() method by default.

public KeyGesture? OpenOptionsMenuKeyGesture { get; set; }

Property Value

KeyGesture:

The default value is Alt+-.

PinButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the pin button content.

public IDataTemplate? PinButtonContentTemplate { get; set; }

Property Value

IDataTemplate

RestoreButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the restore button content.

public IDataTemplate? RestoreButtonContentTemplate { get; set; }

Property Value

IDataTemplate

RestoreCommand

The ICommand that can restore the window that hosts the container.

public ICommand RestoreCommand { get; }

Property Value

ICommand

SelectedToolWindow

The ToolWindow that is currently selected in the container.

public ToolWindow? SelectedToolWindow { get; }

Property Value

ToolWindow

TemplateSettings

The ToolWindowContainer.ToolWindowContainerTemplateSettings instance that provides calculated values for use with the control's theme or template.

public ToolWindowContainer.ToolWindowContainerTemplateSettings TemplateSettings { get; }

Property Value

ToolWindowContainer.ToolWindowContainerTemplateSettings

TitleBarContextContentAlignment

The alignment of title bar context content.

public ContextContentAlignment TitleBarContextContentAlignment { get; set; }

Property Value

ContextContentAlignment:

The default value is Far.

TitleBarMinHeight

The title bar minimum height.

public double TitleBarMinHeight { get; set; }

Property Value

double

TitleFontFamily

The title's font family.

public FontFamily TitleFontFamily { get; set; }

Property Value

FontFamily

TitleFontSize

The title's font size.

public double TitleFontSize { get; set; }

Property Value

double

TitleFontWeight

The title's font weight.

public FontWeight TitleFontWeight { get; set; }

Property Value

FontWeight:

The default value is Avalonia.Media.FontWeight.Normal.

ToggleAutoHideCommand

The ICommand that can toggle the container between an auto-hide and docked state.

public ICommand ToggleAutoHideCommand { get; }

Property Value

ICommand

UnpinButtonContentTemplate

The Avalonia.Controls.Templates.IDataTemplate to use for the unpin button content.

public IDataTemplate? UnpinButtonContentTemplate { get; set; }

Property Value

IDataTemplate

Windows

The collection of child DockingWindow objects.

[Content]
public ObservableCollection<DockingWindow> Windows { get; }

Property Value

ObservableCollection<DockingWindow>

Methods

AutoHide()

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

public void AutoHide()

Remarks

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

AutoHide(Dock)

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

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

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

Remarks

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

Close()

Closes the tool windows in the container, removing them from the layout.

public bool Close()

Returns

bool:

true if all tool windows were closed successfully; otherwise, false.

Dock()

Docks the contained ToolWindow controls back to their default docked location.

public void Dock()

Remarks

Using this method places the contained ToolWindow controls in a DockedState.

OnApplyTemplate(TemplateAppliedEventArgs)

Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.

protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameter Type Description
e TemplateAppliedEventArgs

The event args.

OnCreateAutomationPeer()

Returns a new, type-specific Avalonia.Automation.Peers.AutomationPeer implementation for the control.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer:

The type-specific Avalonia.Automation.Peers.AutomationPeer implementation.

OnDockSiteChanged(DockSite?, DockSite?)

Called when the DockSite property is changed.

protected override void OnDockSiteChanged(DockSite? oldDockSite, DockSite? newDockSite)
Parameter Type Description
oldDockSite DockSite

The old value.

newDockSite DockSite

The new value.

OnKeyDown(KeyEventArgs)

Called before the Avalonia.Input.InputElement.KeyDown event occurs.

protected override void OnKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The event args.

OnPointerPressed(PointerPressedEventArgs)

Called before the Avalonia.Input.InputElement.PointerPressed event occurs.

protected override void OnPointerPressed(PointerPressedEventArgs e)
Parameter Type Description
e PointerPressedEventArgs

The event args.

OnPointerReleased(PointerReleasedEventArgs)

Called before the Avalonia.Input.InputElement.PointerReleased event occurs.

protected override void OnPointerReleased(PointerReleasedEventArgs e)
Parameter Type Description
e PointerReleasedEventArgs

The event args.

OnTabControlMenuOpening(AdvancedTabControlMenuEventArgs)

Called when a menu on the tab control is opening.

protected override void OnTabControlMenuOpening(AdvancedTabControlMenuEventArgs e)
Parameter Type Description
e AdvancedTabControlMenuEventArgs

The AdvancedTabControlMenuEventArgs that contains the event data.

OnWindowsChanged(NotifyCollectionChangedEventArgs)

Called when the windows collection is changed.

protected override void OnWindowsChanged(NotifyCollectionChangedEventArgs e)
Parameter Type Description
e NotifyCollectionChangedEventArgs

A NotifyCollectionChangedEventArgs that contains the event data.

OpenOptionsMenu()

Opens the options menu for the SelectedWindow.

public void OpenOptionsMenu()

OpenOptionsMenu(Control?)

Opens the options menu for the SelectedWindow under the specified placement target element.

public void OpenOptionsMenu(Control? placementTarget)
Parameter Type Description
placementTarget Control

The optional Avalonia.Controls.Control under which to open the menu.

UpdateCommands()

Updates the enabled states of the commands.

protected override void UpdateCommands()

UpdateDockingWindowStates()

Updates the DockingWindowState associated with all child docking windows.

protected override void UpdateDockingWindowStates()

UpdateIsTabStripVisible()

Updates the IsTabStripVisible property.

protected override void UpdateIsTabStripVisible()

UpdateTitleBarButtonVisibility()

Updates the title bar button visibility.

protected override void UpdateTitleBarButtonVisibility()

ValidateChildType(DockingWindow)

Validates that the specified child DockingWindow type is valid for this container.

protected override void ValidateChildType(DockingWindow window)
Parameter Type Description
window DockingWindow

The DockingWindow to examine.

Fields

CloseButtonContentTemplateProperty

Defines the CloseButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> CloseButtonContentTemplateProperty

CloseKeyGestureProperty

Defines the CloseKeyGesture property.

public static readonly StyledProperty<KeyGesture?> CloseKeyGestureProperty

EmbeddedButtonThemeProperty

Defines the EmbeddedButtonTheme property.

public static readonly StyledProperty<ControlTheme?> EmbeddedButtonThemeProperty

HasCloseButtonProperty

Defines the HasCloseButton property.

public static readonly StyledProperty<bool> HasCloseButtonProperty

HasTitleBarGripperProperty

Defines the HasTitleBarGripper property.

public static readonly StyledProperty<bool> HasTitleBarGripperProperty

HasTitleBarIconProperty

Defines the HasTitleBarIcon property.

public static readonly StyledProperty<bool> HasTitleBarIconProperty

HasToggleAutoHideButtonProperty

Defines the HasToggleAutoHideButton property.

public static readonly StyledProperty<bool> HasToggleAutoHideButtonProperty

IsCloseButtonVisibleProperty

Defines the IsCloseButtonVisible property.

public static readonly StyledProperty<bool> IsCloseButtonVisibleProperty

IsMaximizeButtonVisibleProperty

Defines the IsMaximizeButtonVisible property.

public static readonly StyledProperty<bool> IsMaximizeButtonVisibleProperty

IsMinimizeButtonVisibleProperty

Defines the IsMinimizeButtonVisible property.

public static readonly StyledProperty<bool> IsMinimizeButtonVisibleProperty

IsOptionsButtonVisibleProperty

Defines the IsOptionsButtonVisible property.

public static readonly StyledProperty<bool> IsOptionsButtonVisibleProperty

IsRestoreButtonVisibleProperty

Defines the IsRestoreButtonVisible property.

public static readonly StyledProperty<bool> IsRestoreButtonVisibleProperty

IsToggleAutoHideButtonVisibleProperty

Defines the IsToggleAutoHideButtonVisible property.

public static readonly StyledProperty<bool> IsToggleAutoHideButtonVisibleProperty

MaximizeButtonContentTemplateProperty

Defines the MaximizeButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> MaximizeButtonContentTemplateProperty

MenuButtonContentTemplateProperty

Defines the MenuButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> MenuButtonContentTemplateProperty

MinimizeButtonContentTemplateProperty

Defines the MinimizeButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> MinimizeButtonContentTemplateProperty

OpenOptionsMenuKeyGestureProperty

Defines the OpenOptionsMenuKeyGesture property.

public static readonly StyledProperty<KeyGesture?> OpenOptionsMenuKeyGestureProperty

PinButtonContentTemplateProperty

Defines the PinButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> PinButtonContentTemplateProperty

RestoreButtonContentTemplateProperty

Defines the RestoreButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> RestoreButtonContentTemplateProperty

SelectedToolWindowProperty

Defines the SelectedToolWindow property.

public static readonly DirectProperty<ToolWindowContainer, ToolWindow?> SelectedToolWindowProperty

TitleBarContextContentAlignmentProperty

Defines the TitleBarContextContentAlignment property.

public static readonly StyledProperty<ContextContentAlignment> TitleBarContextContentAlignmentProperty

TitleBarMinHeightProperty

Defines the TitleBarMinHeight property.

public static readonly StyledProperty<double> TitleBarMinHeightProperty

TitleFontFamilyProperty

Defines the TitleFontFamily property.

public static readonly StyledProperty<FontFamily> TitleFontFamilyProperty

TitleFontSizeProperty

Defines the TitleFontSize property.

public static readonly StyledProperty<double> TitleFontSizeProperty

TitleFontWeightProperty

Defines the TitleFontWeight property.

public static readonly StyledProperty<FontWeight> TitleFontWeightProperty

UnpinButtonContentTemplateProperty

Defines the UnpinButtonContentTemplate property.

public static readonly StyledProperty<IDataTemplate?> UnpinButtonContentTemplateProperty

Inherited Members

Extension Methods