Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
davidortinau avatar

Maui Theming

  • 43 installs
  • 163 repo stars
  • Updated July 6, 2026
  • davidortinau/maui-skills

Themes .NET MAUI apps with light/dark mode support via AppThemeBinding, dynamic resources, ResourceDictionary switching, and system theme detection.

About

Guides theming .NET MAUI apps with light/dark mode support via AppThemeBinding, dynamic resources, ResourceDictionary theme switching and system theme detection. A developer uses it when adding dark mode and dynamic theming to a MAUI app.

  • Light/dark mode via AppThemeBinding and dynamic resources
  • ResourceDictionary theme switching and system theme detection

Maui Theming by the numbers

  • 43 all-time installs (skills.sh)
  • Ranked #616 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davidortinau/maui-skills --skill maui-theming

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs43
repo stars163
Last updatedJuly 6, 2026
Repositorydavidortinau/maui-skills

What it does

Themes .NET MAUI apps with light/dark mode support via AppThemeBinding, dynamic resources, ResourceDictionary switching, and system theme detection.

Files

SKILL.mdMarkdownGitHub ↗

.NET MAUI Theming

Choosing your approach

ApproachBest forLimitation
AppThemeBindingAuto light/dark with OS — minimal codeOnly two themes (light + dark)
ResourceDictionary swapCustom branded themes, >2 themes, user preferenceMore setup, must use DynamicResource everywhere
Both combinedAuto OS response + custom theme colorsMost flexible but most complex

Critical gotchas

Android: ConfigChanges.UiMode is REQUIRED

MainActivity must include ConfigChanges.UiMode or theme change events will not fire and the activity restarts instead of handling the change:

[Activity(Theme = "@style/Maui.SplashTheme",
          MainLauncher = true,
          ConfigurationChanges = ConfigChanges.ScreenSize
                               | ConfigChanges.Orientation
                               | ConfigChanges.UiMode  // ← Required for theme detection
                               | ConfigChanges.ScreenLayout
                               | ConfigChanges.SmallestScreenSize
                               | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity { }

Without UiMode, toggling dark mode in Android settings causes a full activity restart — losing navigation state and appearing as a crash to users.

CSS themes cannot be swapped at runtime

MAUI supports CSS styling, but CSS-based themes cannot be swapped dynamically. Use ResourceDictionary theming for runtime switching.

DynamicResource vs StaticResource

When using ResourceDictionary theme switching, you must use DynamicResource:

<!-- ✅ Updates when theme dictionary changes -->
<Label TextColor="{DynamicResource PrimaryTextColor}" />

<!-- ❌ Frozen at first load — won't update on theme switch -->
<Label TextColor="{StaticResource PrimaryTextColor}" />

Quick reference

  • OS light/darkAppThemeBinding markup extension
  • Theme colors in C#SetAppThemeColor(), SetAppTheme<T>()
  • Read OS themeApplication.Current.RequestedTheme
  • Force themeApplication.Current.UserAppTheme = AppTheme.Dark
  • Theme changesRequestedThemeChanged event
  • Custom switching → Swap ResourceDictionary in MergedDictionaries
  • Runtime bindings`DynamicResource` (not StaticResource)

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.