。(button使用contont写的时候) 当。button使用 <button.content><textBlock/></button.content>依然会覆盖
这段代码能消除全局textblock对button的影响
<DataTemplate DataType="{x:Type System:String}">
<TextBlock Text="{Binding}">
<TextBlock.Resources>
<Style TargetType="{x:Type TextBlock}"/>
</TextBlock.Resources></TextBlock>
</DataTemplate>
button style
<Style TargetType="Button">
<Setter Property="Foreground" Value="Blue"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="" BorderBrush="Black" BorderThickness=""> <ContentPresenter Grid.Row="" Margin="">
<ContentPresenter.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Blue"/>
</Style>
</ContentPresenter.Resources>
</ContentPresenter> </Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
textblock style
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Red"/>
</Style>
这样。。button里面的字是蓝色。。textblock里面是红色
还有button的style覆盖。。datepicker里面的按钮的style