Wpf 动画完成后,KeyFrameAnimation不允许我手动覆盖动画值
我有一个带有KeyFrameAnimation FadeIn效果的窗口Wpf 动画完成后,KeyFrameAnimation不允许我手动覆盖动画值,wpf,animation,Wpf,Animation,我有一个带有KeyFrameAnimation FadeIn效果的窗口 <Storyboard x:Key="FadeIn"> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="window" Storyboard.TargetProperty="(UIElement.Opacity)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" />
<Storyboard x:Key="FadeIn">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="window" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0" Value="0" />
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0.8" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Window.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard x:Name="BusyAnimation_BeginStoryboard" Storyboard="{StaticResource FadeIn}" />
</EventTrigger>
</Window.Triggers>
只要触发器处于激活状态,这将不起作用。不知何故,动画让我可以手动设置这些属性。我怎样才能保持动画效果,并让MouseEnter和MouseLeave按照我的预期运行?你有什么收获吗?我也有同样的问题。不幸的是,我没有找到解决办法。我现在删除了动画。
private void FancyNotificationView_OnMouseEnter(object sender, MouseEventArgs e)
{
SetValue(Window.OpacityProperty, 1.0);
Debug.WriteLine((double) GetValue(Window.OpacityProperty));
}
private void FancyNotificationView_OnMouseLeave(object sender, MouseEventArgs e)
{
SetValue(Window.OpacityProperty, 0.8);
}