情节提要的默认行为是继续将属性值设置为动画最后一帧的值。看到了吗
Animation Tips and Tricks
,尤其是“设置属性动画后无法更改属性值”部分。你永远不会停止故事板,所以最终他们都在运行,无论最后一个被宣布是设置最终值。
你可以设置
FillBehavior
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsSelected" Value="False" />
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.15"
Storyboard.TargetName="border"
Storyboard.TargetProperty="Background.Color" To="#00F" />
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard FillBehavior="Stop">
<ColorAnimation Duration="0:0:0.3"
Storyboard.TargetName="border"
Storyboard.TargetProperty="Background.Color" To="#008" />
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
<Trigger Property="IsSelected" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.15"
Storyboard.TargetName="border"
Storyboard.TargetProperty="Background.Color" To="#F00" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard FillBehavior="Stop">
<ColorAnimation Duration="0:0:0.3"
Storyboard.TargetName="border"
Storyboard.TargetProperty="Background.Color" To="#800" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>