#93 – Specifying Markup Extensions Using Property Element Syntax

Markup extensions are typically expressed directly as property values using braces–{, }. (Property attribute syntax).

 <Button Name="btnOne" Background="{StaticResource aliceBrush}" Content="Dum" Height="23" Width="75" />

But a markup extension can also be expressed using property element syntax.  The XAML fragment below is equivalent to the one listed above.

 <Button Name="btnOne" Content="Dum" Height="23" Width="75">
     <Button.Background>
         <StaticResource ResourceKey="aliceBrush"/>
     </Button.Background>
 </Button>
Advertisement