How DialogHost and ShadUI.Window interact
mainIn ShadUI, DialogHost is designed to be decoupled from ShadUI.Window. It can be hosted anywhere (a vanilla Avalonia.Controls.Window, a UserControl, or a Panel), but it gains special window-level features when it detects an Avalonia.Controls.Window ancestor in its visual tree.
Key Behaviors
- Inside a
ShadUI.Window: If you add aDialogHostto theHostscollection of aShadUI.Window, the window automatically subscribes to the host'sHasOpenDialogstate. This enables features like snap-layout suppression (preventing Windows snap-layout flyouts from appearing when a dialog is open). - Inside other containers: When hosted in a
UserControlorPanel,DialogHoststill functions for dialog management, but window-specific UX like title-bar dragging and double-tap maximize will be no-ops.
Integration Point
The recommended way to integrate a DialogHost with a ShadUI.Window is via the Window.Hosts collection.
<shadui:Window.Hosts>
<shadui:DialogHost
Manager="{Binding DialogManager}"
x:Name="PART_DialogHost" />
</shadui:Window.Hosts>