Advertisement
Beginner .NET MAUI, XAML & Markup Extensions

What are markup extensions in XAML?

Short answer

Markup extensions provide values to XAML attributes at parse time using {} syntax, e.g., {Binding}, {StaticResource}, {DynamicResource}, {x:Static}, {OnPlatform}, {OnIdiom}. They let you reference resources, bind data, or compute values declaratively instead of hardcoding.

Save .NET MAUI mock interview
Advertisement
AModel answer
Markup extensions provide values to XAML attributes at parse time using {} syntax, e.g., {Binding}, {StaticResource}, {DynamicResource}, {x:Static}, {OnPlatform}, {OnIdiom}. They let you reference resources, bind data, or compute values declaratively instead of hardcoding.
<Label Text="{Binding Title}"
       TextColor="{StaticResource Primary}"
       FontSize="{OnPlatform iOS=17, Android=16}" />
Real-world example
One label pulls its text from a binding, its color from a resource, and a platform-specific font size—all via markup extensions.
Likely follow-ups
  • Name a few built-in extensions. | What syntax do they use?
Related topics