这个 是新知识 样式可以继承
<Style x:Key="TextBlockStyleBase" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="TextTrimming" Value="None"/>
<Setter Property="Background" Value="#FF666666"/>
<Setter Property="Foreground" Value="White"/>
</Style>
<Style x:Key="TextBlockStyle1" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextBlockStyleBase}">
<Setter Property="Foreground" Value="Red"/>
</Style>
<Style x:Key="TextBlockStyle2" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TextBlockStyleBase}">
<Setter Property="Background" Value="Brown"/>
<Setter Property="Foreground" Value="Beige"/>
</Style>
</Window.Resources>
<Grid>
<TextBlock HorizontalAlignment="Left" Height="42" Margin="60.5,43,0,0" TextWrapping="Wrap" Text="TextBlockBase" VerticalAlignment="Top" Width="228" Style="{DynamicResource TextBlockStyleBase}"/>
<TextBlock HorizontalAlignment="Left" Height="42" Margin="60,112,0,0" TextWrapping="Wrap" Text="TextBlock1" VerticalAlignment="Top" Width="228" Style="{DynamicResource TextBlockStyle1}"/>
<TextBlock HorizontalAlignment="Left" Height="42" Margin="60,179,0,0" TextWrapping="Wrap" Text="TextBlock2" VerticalAlignment="Top" Width="228" Style="{DynamicResource TextBlockStyle2}"/>
</Grid>
定义了一个主样式 俩个样 用 BasedOn 来继承 修改 或增加 显示不同的效果