.NET MAUI › Styling, Resources & Themes

What is a ResourceDictionary and how do you use it?

Beginner

Answer

A ResourceDictionary stores reusable resources (colors, styles, templates, converters) keyed by x:Key. Define it at app, page, or control scope; reference resources with StaticResource (resolved once) or DynamicResource (tracks changes). App-level resources in App.xaml are available everywhere.
<Application.Resources>
    <ResourceDictionary>
        <Color x:Key="Primary">#512BD4</Color>
    </ResourceDictionary>
</Application.Resources>
<Button BackgroundColor="{StaticResource Primary}" />
Real-world example Brand colors defined once in App.xaml are reused across every page via StaticResource.

Common follow-ups: StaticResource vs DynamicResource? | Where do global resources live?