maui-theming

Implement light and dark theming for .NET MAUI apps with AppThemeBinding and ResourceDictionary swapping.

1|Updated May 21, 2026
One-click install
npx skills add https://github.com/1k-off/umbraco-observability-playground --skill maui-theming-1k-off
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: maui-theming
Source: https://github.com/1k-off/umbraco-observability-playground/tree/main/.agents/skills/maui-theming
Command: npx skills add https://github.com/1k-off/umbraco-observability-playground --skill maui-theming-1k-off

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the problem of building a .NET MAUI app UI that correctly adapts to light/dark mode (including system-driven changes and user preferences) without hardcoded colors that break theme switching.

Core Features & Use Cases

  • AppThemeBinding for OS light/dark: Apply light and dark values directly in XAML for consistent automatic theme behavior.
  • ResourceDictionary swapping for custom themes: Create branded light/dark (or multiple) themes using matching resource keys and swap them at runtime.
  • System theme detection and runtime reaction: Read Application.Current.RequestedTheme, subscribe to RequestedThemeChanged, and update UI/dictionaries accordingly.
  • Persisted user theme preference: Save the user’s choice via Preferences and apply it on startup.
  • DynamicResource correctness: Ensure theme-swapped resources update live by using DynamicResource instead of StaticResource.

Quick Start

Tell the AI: "Help me add light/dark support to my .NET MAUI app using AppThemeBinding and DynamicResource, detect system theme changes, and persist the user’s preferred theme with Preferences."

Frequently Asked Questions about maui-theming

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement light and dark mode in a .NET MAUI app?

To implement light and dark mode in .NET MAUI, use AppThemeBinding in XAML for automatic OS theme switching or swap ResourceDictionary instances at runtime, ensuring theme-sensitive values use DynamicResource for live UI updates.

Why are my .NET MAUI theme resources not updating when I swap ResourceDictionary at runtime?

Your .NET MAUI theme resources are not updating because StaticResource captures values once at load time. You must use DynamicResource in XAML to ensure UI elements reflect runtime ResourceDictionary swaps and live theme changes.

How do I detect and respond to system light dark mode changes in .NET MAUI?

To detect system light dark mode changes in .NET MAUI, read Application.Current.RequestedTheme and subscribe to the RequestedThemeChanged event, ensuring Android MainActivity includes ConfigChanges.UiMode for reliable theme event delivery.

Can I persist a user's theme preference in .NET MAUI and apply it on startup?

You can persist a user's theme preference in .NET MAUI by saving their choice with Preferences and applying the saved theme by setting UserAppTheme during application startup before the UI loads.

What is the difference between AppThemeBinding and ResourceDictionary swapping for .NET MAUI theming?

AppThemeBinding applies light and dark values directly in XAML for automatic OS-driven switching, while ResourceDictionary swapping enables custom branded themes by matching resource keys across dictionaries and swapping them at runtime.