Hosts a modal window as an overlay within the visual tree. Used by PleasantUI controls like ContentDialog, CrashReportDialog, and StepDialog to display modal overlays.
The ModalWindowHost is typically created and managed by PleasantUI modal controls automatically:
// ContentDialog creates its own host internally
await dialog.ShowAsync(window);| Property | Type | Default | Description |
|---|---|---|---|
HorizontalContentAlignment |
HorizontalAlignment |
Center |
Horizontal alignment of the content within the host |
VerticalContentAlignment |
VerticalAlignment |
Center |
Vertical alignment of the content within the host |
Control how the modal content is positioned:
<ModalWindowHost HorizontalContentAlignment="Center"
VerticalContentAlignment="Center">
<!-- Modal content -->
</ModalWindowHost>Available alignments:
Center(default)StretchLeft/RightTop/Bottom
The host automatically handles all pointer events and marks them as handled to prevent interaction with the underlying content while the modal is visible. This includes:
PointerEnteredPointerExitedPointerPressedPointerReleasedPointerCaptureLostPointerMovedPointerWheelChanged
The host automatically tracks changes in the root control's bounds and invalidates its measure when the root size changes. This ensures the modal overlay always fills the available space.
- This control is typically created and managed by PleasantUI modal controls, not instantiated directly
- The control has no background by default
- All pointer events are automatically handled to prevent interaction with underlying content
- The host measures to the size of the top-level client size or the content size