Microsoft Dot Net Master

Microsoft Dot Net Master
Microsoft Dot Net Master

Monday, July 23, 2012

Style inheritance

Style inheritance

A style in WPF can base on another style. This allows you to specify a base style that sets common properties and derive from it for specialized controls.
 
<Style x:Key="baseStyle" TargetType="TextBlock">
  <Setter Property="FontSize" Value="12" />
  <Setter Property="Background" Value="Orange" />
</Style>
 
 
<Style x:Key="boldStyle" BasedOn="{StaticResource baseStyle}" TargetType="TextBlock">
  <Setter Property="FontWeight" Value="Bold" />
</Style>
 

No comments:

Post a Comment