Class Dialog
A modal overlay - a full-viewport dimming backdrop (Chrome, themed) behind a centered content box, blocking pointer input to everything behind it (see the type's own remarks) and trapping keyboard/gamepad focus while IsOpen. Carries no result of its own - see Dialog<TResult> for the Task-returning API most callers actually want; this class is its non-generic (themeable) building block.
public class Dialog : ContentControl, INotifyPropertyChanging, IBindingTarget, INotifyPropertyChanged, INotifyFocusChanged, IContainerLayout
- Inheritance
-
Dialog
- Implements
- Inherited Members
- Extension Methods
Remarks
Reuses HitTest(Point)'s existing overlay-first, topmost-wins behavior for pointer modality - no new Canvas mechanism is needed. A backdrop click is swallowed (nothing behind the overlay is ever hit-tested) but never closes the dialog by itself; only an explicit Close() call (e.g. a button) or Escape does.
Properties
IsOpen
Gets a value indicating whether this dialog is currently shown.
public bool IsOpen { get; }
Property Value
Methods
Close()
Closes this dialog - removes the overlay, restores whatever was focused before Show(Canvas), and raises Closed. A no-op if this dialog isn't currently open.
public void Close()
Show(Canvas)
Shows this dialog as a modal overlay on canvas - adds it to
Overlays, enters a focus scope (mirrors OnOpened()), and
subscribes Escape (CloseModal) to Close(). A no-op if
already open.
public void Show(Canvas canvas)
Parameters
canvasCanvasThe canvas to show this dialog on.
Events
Closed
public event EventHandler? Closed