Back to results for “Styling”
.NET MAUI › Advanced & Enterprise

How do you theme a MAUI app and support light/dark mode?

Intermediate

Answer

Define colors and styles in ResourceDictionaries (App.xaml), use AppThemeBinding to switch values by system theme, and read/set Application.Current.UserAppTheme to override. Centralize styles with implicit and explicit Style resources so theming is consistent and switchable at runtime.
<Label TextColor="{AppThemeBinding Light=Black, Dark=White}" />
Application.Current.UserAppTheme = AppTheme.Dark;   // force dark
Real-world example The app follows the OS dark mode automatically but also lets users force a theme from settings via UserAppTheme.

Common follow-ups: What is AppThemeBinding? | How do you force a theme?