.NET MAUI › Styling, Resources & Themes

How do you merge and organize multiple ResourceDictionaries?

Intermediate

Answer

Split resources into separate XAML dictionaries (Colors.xaml, Styles.xaml) and combine them via MergedDictionaries in App.xaml. This keeps theming modular and lets you swap a dictionary (e.g., a theme) at runtime by replacing entries in Application.Current.Resources.MergedDictionaries.
<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <local:Colors />
        <local:Styles />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Real-world example A design system lives in Colors.xaml and Styles.xaml, merged in App.xaml and shared across the whole app.

Common follow-ups: How do you swap a theme dictionary at runtime? | Why split dictionaries?