1.是按钮的边框有闪烁的效果,是根据属性来设置的而非一般的事件
1 <Style x:Key="PipesButtonStyle" TargetType="Button"> 2 <Setter Property="Height" Value="25"/> 3 <Setter Property="IsHitTestVisible" Value="False"/> 4 <Setter Property="Background" Value="Transparent"/> 5 <Setter Property="Template"> 6 <Setter.Value> 7 <ControlTemplate TargetType="{x:Type Button}"> 8 <Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" BorderBrush="Transparent" Background="{TemplateBinding Background}" RenderPressed="{TemplateBinding IsPressed}" RenderDefaulted="{TemplateBinding IsDefaulted}" SnapsToDevicePixels="true"/> 9 </ControlTemplate> 10 </Setter.Value> 11 </Setter> 12 <Setter Property="Effect"> 13 <Setter.Value> 14 <DropShadowEffect x:Name="effect" BlurRadius="0" Color="Red" Direction="0" 15 Opacity="0" RenderingBias="Performance" ShadowDepth="0"/> 16 </Setter.Value> 17 </Setter> 18 <Style.Triggers> 19 <Trigger Property="IsHitTestVisible" Value="true"> 20 <Trigger.EnterActions> 21 <BeginStoryboard x:Name="enterStory"> 22 <Storyboard> 23 <DoubleAnimation Storyboard.TargetProperty="(FrameworkElement.Effect).(DropShadowEffect.BlurRadius)" 24 BeginTime="00:00:00" Duration="00:00:01" 25 From="0" To="10" 26 AutoReverse="True" RepeatBehavior="Forever"> 27 </DoubleAnimation> 28 <DoubleAnimation Storyboard.TargetProperty="(FrameworkElement.Effect).(DropShadowEffect.Opacity)" 29 BeginTime="00:00:00" Duration="00:00:00" 30 From="0" To="1" > 31 </DoubleAnimation> 32 </Storyboard> 33 </BeginStoryboard> 34 </Trigger.EnterActions> 35 <Trigger.ExitActions> 36 <StopStoryboard BeginStoryboardName="enterStory"> 37 </StopStoryboard> 38 </Trigger.ExitActions> 39 </Trigger> 40 </Style.Triggers> 41 </Style>
2.遇到问题:如果我要感觉Content的值来设置Content的值是不行的,会报错。(错误原因为止,有待商榷)