Switching MAUI Themes at Runtime
Offering a user-selectable theme, honoring the system’s light or dark mode and supporting white-label branding all come down to the same mechanism: changing which theme dictionary is active. This UXDivers walkthrough shows that mechanism end to end.
The example uses the Light and Dark themes on a Grial OrganizationFormPage. A toolbar item, using Grial’s ExtendedToolbarItem so its color can change dynamically, is bound to a SwitchThemesCommand. That command looks in the app’s MergedDictionaries for LightTheme, removes it and adds DarkTheme, or does the reverse.
The second half covers the device setting. You subscribe to RequestedThemeChanged in App.xaml.cs, apply the matching theme in a small ApplyTheme method, and call it once at startup so the initial state is correct.
The code is short enough to adapt quickly, even if you don’t use Grial for the rest of your UI.