Back to results for “Styling”
.NET MAUI › Styling, Resources & Themes

What is the difference between an implicit and an explicit Style?

Beginner

Answer

An explicit Style has an x:Key and is applied where referenced via Style="{StaticResource ...}". An implicit Style has no key, only a TargetType, and applies automatically to all controls of that type in scope. Implicit styles set defaults; explicit styles are opt-in variants.
<Style TargetType="Button">              <!-- implicit: all buttons -->
    <Setter Property="CornerRadius" Value="8" />
</Style>
<Style x:Key="Danger" TargetType="Button"> <!-- explicit -->
    <Setter Property="BackgroundColor" Value="Red" />
</Style>
Real-world example All buttons get rounded corners via an implicit style, while delete buttons opt into a red 'Danger' explicit style.

Common follow-ups: How do styles inherit? | What is BasedOn?