WPF:在ExpressionBlend中,如何更改具有不同状态边界的自定义按钮的前景?
在Expression Blend 4中,我想更改不同状态下自定义按钮的前景。我只能更改WPF:在ExpressionBlend中,如何更改具有不同状态边界的自定义按钮的前景?,wpf,templates,styles,expression-blend,Wpf,Templates,Styles,Expression Blend,在Expression Blend 4中,我想更改不同状态下自定义按钮的前景。我只能更改背景和边框笔刷 就这样, 如果状态为“正常”,则文本“按钮”的颜色为黑色,而状态为“按下”,则文本“按钮”的颜色为白色 在画笔面板的属性面板下,有3个属性,但没有前台属性: 谁能帮我?我很困惑 编辑 我发现ContentControl有一个Foreground属性,但是ContentPresenter没有。我是否应该使用ContentControl而不是ContentPresenter?到目前为止,我还没
背景
和边框笔刷
就这样,
如果状态为“正常”,则文本“按钮”的颜色为黑色
,而状态为“按下”,则文本“按钮”的颜色为白色
在画笔面板
的属性面板
下,有3个属性,但没有前台
属性:
谁能帮我?我很困惑
编辑
我发现
ContentControl
有一个Foreground
属性,但是ContentPresenter
没有。我是否应该使用ContentControl
而不是ContentPresenter
?到目前为止,我还没有找到通过混合来改变前景的方法(我的意思是不在代码中)。在代码中,就像这样:
<ResourceDictionary ...>
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
<Setter Property="Template">
...
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
...
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimationUsingKeyFrames
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="0" Value="Blue"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
...
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter .../>
...
</ResourceDictionary>
...
...
...
...