更改组合框的颜色 [英] Change color of Combobox

查看:77
本文介绍了更改组合框的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用System.Windows.Controls.ComboBox.我想在一段时间内更改它的背景颜色,因为它看起来像是闪烁的

谢谢

Hi All,

I am using System.Windows.Controls.ComboBox. and i want to change background color of it for some interval as it looks like blinking

Thanks

推荐答案

尝试编写以下情节提要特效.

Try to write the below Storyboard effects.

<UserControl.Triggers>
    <EventTrigger RoutedEvent="local:LedControl.Blink">
        <EventTrigger.Actions>
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="glow"

                                     Storyboard.TargetProperty="Opacity"

                                     To="100"

                                     AutoReverse="True"

                                     Duration="0:0:0.075" />
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ledEllipse"

                                                  Storyboard.TargetProperty="Fill"

                                                  Duration="0:0:0.15">
                        <ObjectAnimationUsingKeyFrames.KeyFrames>
                            <DiscreteObjectKeyFrame KeyTime="0:0:0.01">
                                <DiscreteObjectKeyFrame.Value>
                                    <RadialGradientBrush>
                                        <!--bright Green Brush-->
                                        <GradientStop Color="#FF215416" Offset="1"/>
                                        <GradientStop Color="#FE38DA2E" Offset="0"/>
                                        <GradientStop Color="#FE81FF79" Offset="0.688"/>
                                    </RadialGradientBrush>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:0.15" >
                                <DiscreteObjectKeyFrame.Value>
                                    <RadialGradientBrush>
                                        <!--dim Green Brush-->
                                        <GradientStop Color="#FF21471A" Offset="1"/>
                                        <GradientStop Color="#FF33802F" Offset="0"/>
                                        <GradientStop Color="#FF35932F" Offset="0.688"/>
                                    </RadialGradientBrush>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames.KeyFrames>
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger.Actions>
    </EventTrigger>
</UserControl.Triggers>





后来,组合框被应用,具有以下效果:





Later, Combobox is applied with the above effect as:

<ComboBox>
    <ComboBox.Effect>
        <DropShadowEffect x:Name="glow" ShadowDepth="0" Color="Lime" BlurRadius="10" Opacity="0" />
    </ComboBox.Effect>
</ComboBox>


帮自己一个忙-不要这样做-用户将非常恼火.如果您不想遵循这个友好的建议,请使用计时器.

Do yourself a great favor — don''t do it — you users will be extremely irritated. If you don''t want to follow this good friendly advice, use the timer.


这篇关于更改组合框的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆