I created a button style for my project. I want the button to flash when the user moves the cursor over it. I do it with this code:
<Trigger Property="IsMouseOver" Value="True">开发者_C百科;
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.Color" Duration="0:0:0.2" From="#808000" To="#ffaec9" RepeatBehavior="Forever" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
I also want then user focus button it to also flash. But if I create similar code for IsFocused property will not work as I want. Can i use the property concatenation in Property attribute of tag trigger? Can i create sequence of triggers (trigger1 work if it worked before triпger2 and will not work if worked trigger3)?
use this state, it will work on your button
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)" Storyboard.TargetName="Background" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
精彩评论