Class Window
A modal dialog - a IsFocusScope that traps Tab/gamepad focus traversal within itself while IsOpen, and restores whatever was focused before it opened when it closes.
public class Window : ContentControl, INotifyPropertyChanging, IBindingTarget, INotifyPropertyChanged, INotifyFocusChanged, IContainerLayout
- Inheritance
-
Window
- Implements
- Inherited Members
- Extension Methods
Remarks
No backdrop/pointer-input isolation in v1 - opening a Window only traps keyboard/gamepad focus traversal (via IsFocusScope, see MoveFocus(bool)); elements behind it remain clickable. A caller wanting true pointer modality needs to layer that on top (e.g. a full-screen sibling element with a high enough ZIndex) - not attempted here.
Must be added to a Canvas (directly or nested) like any other element - there's no separate popup/overlay layer; position it (e.g. via ZIndex) as needed.
Constructors
Window()
Initializes a new instance of the Window class.
public Window()
Properties
IsOpen
Gets or sets a value indicating whether the window is open. Setting this also sets IsVisible and, when opening, focuses the window itself (if IsFocusable) or otherwise its first focusable descendant.
public bool IsOpen { get; set; }
Property Value
Methods
Close()
public void Close()
OnClosed()
Raises Closed and restores whatever was focused before this window was entered (via CloseFocusScope(UIElement)).
protected virtual void OnClosed()
OnOpened()
Raises Opened and focuses this window (if focusable) or its first focusable descendant.
protected virtual void OnOpened()
Show()
public void Show()
Events
Closed
public event EventHandler? Closed
Event Type
Opened
public event EventHandler? Opened