Theming

WinUI 3 supports tri-state theming: Light, Dark, and High Contrast.

  • Set app-level theme via Application.RequestedTheme, override per-element with FrameworkElement.RequestedTheme
  • Colors and brushes MUST use ThemeResource (not StaticResource) — enables runtime theme switching
  • Semantic color resources (TextFillColorPrimary, CardBackgroundFillColorDefault) SHOULD be used instead of hex values
  • Define custom theme-aware colors in a ResourceDictionary with Default/Light/Dark theme dictionaries
<!-- Good: semantic theme resource -->
<TextBlock Foreground="{ThemeResource TextFillColorPrimaryBrush}" />

<!-- Bad: hard-coded color -->
<TextBlock Foreground="#FFFFFF" />
version
1.0.0
platforms
csharp, windows
tags
platform, theming, windows
author
Mike Fullerton
modified
2026-03-27

Change History

Version Date Author Summary
1.0.0 2026-03-27 Mike Fullerton Initial creation