Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 动画完成后,KeyFrameAnimation不允许我手动覆盖动画值_Wpf_Animation - Fatal编程技术网

Wpf 动画完成后,KeyFrameAnimation不允许我手动覆盖动画值

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" />

我有一个带有KeyFrameAnimation FadeIn效果的窗口

<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);
    }