This document specifies the current behavior and design of the Dialog control as implemented.
For end-user usage and examples, see Dialog.
Terminal.Live(...)) are not a primary target; dialogs are designed to be hosted in fullscreen apps.Content).Title : Visual?Content : Visual?TopRightText : Visual?BottomLeftText : Visual?BottomRightText : Visual?Padding : Thickness (padding between border and Content)Left : int? / Top : int? (position relative to the dialog’s layout slot)Width : int? / Height : int? (optional fixed size)IsResizable : bool (defaults to true)IsModal : bool (implements IModalVisual for window-layer hit-testing)DialogStyle
GlyphsSurfaceStyleBorderCellStyle / FocusedBorderCellStyleLabelBackgroundStyleResizeHandleHoverStyleShow() (fullscreen only; adds to the current TerminalApp window layer)Close()HorizontalAlignment = Align.Stretch, VerticalAlignment = Align.Stretch.
src/XenoAtom.Terminal.UI/Controls/Dialog.cssrc/XenoAtom.Terminal.UI/Styling/DialogStyle.cssrc/XenoAtom.Terminal.UI/Controls/WindowLayer.cssrc/XenoAtom.Terminal.UI/TerminalApp.cs (ShowWindow, CloseWindow)src/XenoAtom.Terminal.UI.Tests/DialogTests.cssrc/XenoAtom.Terminal.UI.Tests/WindowLayerInteractionTests.cssrc/XenoAtom.Terminal.UI.Tests/OverlaySurfaceTextStyleLeakTests.cssamples/ControlsDemo/Demos/DialogDemo.cssamples/ControlsDemo/Demos/BackdropDemo.cs (dialog + backdrop composition)Show() finds the current TerminalApp via App ?? Dispatcher.AttachedApp and calls TerminalApp.ShowWindow(this).Close() calls TerminalApp.CloseWindow(this) when possible.IsModal = true causes hit-testing/input to be blocked behind the dialog (see WindowLayerInteractionTests).Dialog is still a Visual and can be inserted directly into a tree (e.g. in a ZStack). In that case it renders and supports dragging/resizing,
but “modal” semantics are only meaningful when the host respects IModalVisual (the window layer does).
The measured size includes:
Padding inside the border,Content size,Title + TopRightText, BottomLeftText + BottomRightText).Key rules:
Width / Height (when set) cap the available space for measuring content.Content is measured against:
innerWidth = availableWidth - 2 - padding.HorizontalinnerHeight = availableHeight - 2 - padding.VerticaldesiredWidth = Width ?? (2 + padding.Horizontal + content.DesiredSize.Width)desiredHeight = Height ?? (2 + padding.Vertical + content.DesiredSize.Height)3x3 and respect inherited MinWidth / MinHeight.maxHeight = 1) and can increase the desired width to fit the left/right label pairs.Dialog uses PrepareArrangeBounds to choose its final rect within the host slot:
width = min(slot.Width, clamp(Width ?? DesiredSize.Width, MinWidth, MaxWidth))height = min(slot.Height, clamp(Height ?? DesiredSize.Height, MinHeight, MaxHeight))Left/Top are null, the dialog is centered in the slot.Title is treated as the top-left border label.TopRightText, BottomLeftText, and BottomRightText are arranged like Group labels:
x + 2x + width - 31Content (if present) is arranged inside the inner rect:
x + 1 + padding.Left, y + 1 + padding.TopfinalRect.Width - 2 - padding.HorizontalfinalRect.Height - 2 - padding.VerticalThe dialog renders its own surface and chrome:
Theme.PopupSurface ?? Theme.SurfaceAlt ?? Theme.Surface when available.DialogStyle.Glyphs ?? theme.Lines and DialogStyle.ResolveBorderStyle(...).DialogStyle.ResolveLabelBackgroundStyle().DialogStyle.ResolveResizeHandleHoverStyle(...), while respecting the border-label cutout spans on the top and bottom rows.The dialog explicitly preserves/normalizes text attributes when rendering the surface/chrome (WithTextStyle(...)) so that
decorations like underline from content behind the dialog do not leak into the overlay. This is covered by tests.
uiY == Bounds.Y) starts a drag operation.Left and Top (clamped to the layout slot) so the dialog follows the cursor.IsResizable = true, the dialog exposes pointer handles on:
Left / Top / Width / Height values so the resized placement persists.Left and Width.Width.Height.Width and Height.MinWidth / MinHeight (with an absolute floor of 3x3).WindowLayerInteractionTests:
Left/TopDialogTests:
OverlaySurfaceTextStyleLeakTests:
Escape (optional)