Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WPF:在ExpressionBlend中,如何更改具有不同状态边界的自定义按钮的前景?_Wpf_Templates_Styles_Expression Blend - Fatal编程技术网

WPF:在ExpressionBlend中,如何更改具有不同状态边界的自定义按钮的前景?

WPF:在ExpressionBlend中,如何更改具有不同状态边界的自定义按钮的前景?,wpf,templates,styles,expression-blend,Wpf,Templates,Styles,Expression Blend,在Expression Blend 4中,我想更改不同状态下自定义按钮的前景。我只能更改背景和边框笔刷 就这样, 如果状态为“正常”,则文本“按钮”的颜色为黑色,而状态为“按下”,则文本“按钮”的颜色为白色 在画笔面板的属性面板下,有3个属性,但没有前台属性: 谁能帮我?我很困惑 编辑 我发现ContentControl有一个Foreground属性,但是ContentPresenter没有。我是否应该使用ContentControl而不是ContentPresenter?到目前为止,我还没

在Expression Blend 4中,我想更改不同状态下自定义按钮的前景。我只能更改
背景
边框笔刷

就这样,

如果状态为“正常”,则文本“按钮”的颜色为
黑色
,而状态为“按下”,则文本“按钮”的颜色为
白色

画笔面板
属性面板
下,有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>

...
...
...
...