UI Toolbox logoUI Toolbox

Control a window

Call On Result
OpenWindowAsync(id), OpenWindow(id) Workspace Opens, or focuses an open window.
CloseWindowAsync(id), CloseWindow(id) Workspace Closes with animation.
FocusWindow(id) Workspace Focuses an active window and brings it to the front.
DetachTab(id) Workspace Moves a tab out of its group into a standalone window.
GetWindow(id), GetAllWindows() Workspace Looks up registered windows.
GetContent(id) Workspace The content of a registered window, to find its controls with Q. Throws ArgumentException when no window has the id, and InvalidOperationException when the window has no content.
OpenAsync, MinimizeAsync, MaximizeAsync, RestoreAsync WindowDescriptor Changes the state with animation.
ToggleMinimizeAsync, ToggleMaximizeAsync WindowDescriptor Restores the window if it is in that state, otherwise enters it. The title bar buttons use these.
CycleFocus(backward) Workspace Focuses another open window. See Keyboard shortcuts.
RunCommand(WindowCommand) Workspace Runs a shortcut command on the focused window. See Keyboard shortcuts.
CloseAsync(reason, source, token) WindowDescriptor Closes with animation. Returns false if a Closing handler cancelled. Closing a tab group asks every tab first; if one refuses, nothing closes.
Focus(), BringToFront(), SetBounds(BoundingBox) WindowDescriptor Focus, order and bounds.
MoveTo, Resize, Center WindowFluentAPI extensions Short forms of the calls above.
ArrangeGridAsync, ArrangeCascadeAsync, TileHorizontalAsync, TileVerticalAsync, AutoArrangeAsync, ClearTiling Workspace Arranges the open windows. A window that cannot be dragged, such as a dock zone, keeps its place.

Events:

Event On Argument
WindowStateChanged Workspace WindowStateChangedEventArgs (Descriptor, PreviousState, CurrentState, Change: Opened, Closed, Minimized, Maximized or Restored)
WindowFocusChanged Workspace WindowFocusChangedEventArgs (Descriptor, IsFocused, WasFocused)
StateChanged, FocusChanged WindowDescriptor Same types, for one window.
Closing WindowDescriptor WindowClosingEventArgs (Reason, Source, Cancel)
TitleChanged, PinnedChanged, AttentionChanged, DataSourceChanged WindowDescriptor The descriptor.