xaml按钮焦点与按钮鼠标

问题描述:

我为我的项目创建了一个按钮样式。当用户将光标移动到其上时,我希望按钮闪烁。我这样做与此代码:xaml按钮焦点与按钮鼠标

<Trigger Property="IsMouseOver" Value="True"> 
    <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> 

我也想然后用户焦点按钮它也闪光。但是,如果我为IsFocused属性创建类似的代码将无法正常工作。我可以在标记触发器的属性属性中使用属性串联吗?我可以创建触发器序列(trigger1工作,如果它在triпger2之前工作,并且如果工作trigger3不会工作)?

+1

为什么你的arent考虑多触发器或Visual国家经理的工作? –

使用这种状态下,它会在你的WPF按钮

<VisualState x:Name="MouseOver"> 
     <Storyboard> 
     <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Opacity)" Storyboard.TargetName="Background" d:IsOptimized="True"/> 
     </Storyboard> 
</VisualState>