User-facing applications increasingly expect flexible theming: light/dark modes, branded palettes, and accessibility-friendly variants. Implementing that cleanly in .NET MAUI often becomes boilerplate-heavy because you must manage multiple ResourceDictionary
objects, merge resources, and wire up updates.
Plugin.Maui.Theme by Illya Rybak is a small library that centralizes theme management for MAUI apps. It provides a ThemeService
singleton that registers ResourceDictionary
-based themes, initializes them, and lets you switch at runtime with change notifications. This article provides a review, practical integration steps, examples, and best practices.
Installation
Installation is simple via NuGet Package Manager or CLI:
Minimal Integration Example
To integrate the plugin, initialize it in App.xaml.cs
(or your main window), register your themes, and handle theme changes. This allows runtime switching and persistence.
Example ResourceDictionaries
LightTheme.xaml
DarkTheme.xaml
Strengths
Simple and focused API.
Real-time theme switching.
Event-driven for MVVM integration.
Cross-platform support.
Limitations
Requires predefined
ResourceDictionary
themes.Integer keys may reduce readability if not wrapped.
Automatic system theme sync must be implemented manually.
Developer Notes
Always use resource keys; hard-coded values won’t update dynamically.
Wrap integer theme keys in an enum or constants for clarity.
Keep dictionaries modular for maintainability.
Persist user-selected themes and restore on startup.
Subscribe to
ThemeChanged
for MVVM or non-visual logic updates.Optimize large dictionaries to avoid minor UI performance spikes.
Verdict
Plugin.Maui.Theme makes runtime theming in .NET MAUI simple, centralized, and event-driven. It reduces boilerplate, allows dynamic switching, and integrates well with MVVM patterns. While structured ResourceDictionary
themes are still required, this plugin is an excellent choice for applications needing multiple visual styles or user-controlled theme selection.