WPF 呼吸灯闪烁效果

<Style x:Key="OuterGlowStyle" TargetType="{x:Type FrameworkElement}">
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect x:Name="OG" BlurRadius="0" Color="Tomato" Direction="0"
 Opacity="0.6" RenderingBias="Performance" ShadowDepth="0">
                        <Storyboard.TargetProperty>
                            BlurRadius
                        </Storyboard.TargetProperty>
                    </DropShadowEffect>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <EventTrigger RoutedEvent="GotFocus">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetProperty="(FrameworkElement.Effect).
(DropShadowEffect.BlurRadius)" BeginTime="00:00:00" From="0" To="10" Duration="00:00:01" AutoReverse="True" 
RepeatBehavior="Forever"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Style.Triggers>
        </Style>

所有继承了FrameworkElement的控件都可以使用

image

posted @ 2016-03-03 15:48  晓晓晓  阅读(4127)  评论(0编辑  收藏  举报