Skip to content

Alert

Alert is a hairline-bordered ContentControl for a callout that needs the user’s attention. It is compositional: a consumer nests NaviusAlertTitle and NaviusAlertDescription (and any icon) inside a StackPanel as the single Content. Only two severities ship, Default and Destructive, because the token palette has no dedicated Warning/Success/Info brushes.

xmlns:alert="clr-namespace:Navius.Wpf.Ui.Alert;assembly=Navius.Wpf.Ui"
<alert:NaviusAlert Variant="Destructive">
<StackPanel>
<alert:NaviusAlertTitle Content="Deployment failed" />
<alert:NaviusAlertDescription Content="Check the build log for the exact step that failed." />
</StackPanel>
</alert:NaviusAlert>
Property Type Default From Description
Variant NaviusAlertVariant Default NaviusAlert Default or Destructive. Destructive switches BorderBrush and Foreground to the destructive token.
Content object - ContentControl (NaviusAlert) The alert body; nest NaviusAlertTitle/NaviusAlertDescription in a StackPanel.
Content object - ContentControl (NaviusAlertTitle) The title text. Inherits Foreground from the ancestor NaviusAlert, so it flips color with Variant automatically.
Content object - ContentControl (NaviusAlertDescription) The supplementary text. Foreground is a constant muted token regardless of Variant.

Neither NaviusAlert, NaviusAlertTitle, nor NaviusAlertDescription overrides OnCreateAutomationPeer, and ContentControl’s own base implementation does not create one either, so none of the three types has an automation peer of its own; assistive technology sees only the template’s visual tree (the border and content presenters) and any text content directly. The unit suite exercises variant-driven brush switching (Alert_DefaultVariant_UsesNeutralBorder, Alert_DestructiveVariant_SwitchesBorderAndForegroundToDestructive in tests/Navius.Wpf.Tests/UiDisplayItemsTests.cs), not an automation surface.

  • NaviusAlertDescription keeps a constant muted foreground regardless of Variant; the web contract flips the description color with severity too. This is a deliberate simplification: a muted secondary line reads clearly against either the default or destructive title color without adding a second destructive-text-on-destructive-title legibility question.
  • Only Default/Destructive variants ship. The token set has no Warning/Success/Info brushes, and inventing untokenized colors would break the one-ink discipline, so severity is limited to what the palette actually supports.