This document captures design and implementation notes for Backdrop.
For end-user usage and examples, see Backdrop.
Backdrop : Visual (sealed)HorizontalAlignment = Align.StretchVerticalAlignment = Align.StretchThere are no additional public bindable properties on Backdrop itself; customization is done via BackdropStyle.
Backdrop measures as a fully flexible surface:
SizeHints.Flex(min: 0, natural: 0, max: Infinite, growX: 1, growY: 1, shrinkX: 0, shrinkY: 0)This makes it suitable as the bottom layer of a fullscreen overlay stack (e.g. ZStack in a DialogHost).
No custom arrangement logic. The bounds are determined by parent layout and alignment.
Rendering is a straightforward fill of the Bounds rectangle:
BackdropStyle.Resolve(theme)BackdropStyle.FillRune (default space) and the resolved styleBackdrop intentionally writes both background and foreground so that subsequent visuals that render with
Style.None (inheriting from the buffer) get a stable baseline.
Backdrop behavior is controlled via BackdropStyle:
FillRune (default ' ')Dim (default true): applies TextStyle.DimUseThemeBackground:
false (default): uses Theme.Disabled as the fill background (typical “dimming” behavior)true: uses Theme.Background as the fill background (useful for theme previews / “reset surface” fills)Background / Foreground overrides:
Backdrops are usually placed under dialogs/popups. Historically, if the backdrop only set a background, any underlay foreground (and sometimes text decorations) could leak into overlay content that inherits styles from the buffer.
To prevent this, BackdropStyle.Resolve(...):
Foreground ?? theme.Foreground ?? Color.Default)style.WithTextStyle(style.TextStyle) so the written cell has a concrete text style (avoiding
inheriting decorations like underline from an underlay)This is especially important because many overlay controls render text using defaults that rely on inheritance.
Backdrop has no built-in input handling.
Input behavior (e.g. click outside to close, Esc to dismiss) is provided by higher-level overlay hosts such as dialogs,
popups, command palette, etc.
src/XenoAtom.Terminal.UI.Tests/BackdropStyleTests.cs verifies that the backdrop writes a baseline foreground to
prevent underlay color leaking into overlays.