C# UWP动画不再同时播放

C# UWP动画不再同时播放,c#,.net,animation,uwp,C#,.net,Animation,Uwp,自从将Windows10升级到1909后,我的UWP应用程序中出现了一些非常奇怪的问题。 我有一个XAML动画,如下所示: <Storyboard x:Key="showRightAnswer" x:Name="showRightAnswer"> <ColorAnimationUsingKeyFrames Storyboard.TargetName="answerContainer" Storyboard.TargetProperty="(UIEleme

自从将Windows10升级到1909后,我的UWP应用程序中出现了一些非常奇怪的问题。 我有一个XAML动画,如下所示:

<Storyboard x:Key="showRightAnswer" x:Name="showRightAnswer">
            <ColorAnimationUsingKeyFrames Storyboard.TargetName="answerContainer" Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)">
                <LinearColorKeyFrame KeyTime="0:0:0" Value="Transparent"/>
                <LinearColorKeyFrame KeyTime="0:0:2" Value="#32E662"/>
            </ColorAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames Storyboard.TargetName="answerContainer" Storyboard.TargetProperty="(UIElement.BorderBrush).(SolidColorBrush.Color)">
                <LinearColorKeyFrame KeyTime="0:0:0" Value="#EBEBEB"/>
                <LinearColorKeyFrame KeyTime="0:0:2" Value="#32E662"/>
            </ColorAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames Storyboard.TargetName="answer" Storyboard.TargetProperty="(UIElement.Foreground).(SolidColorBrush.Color)">
                <LinearColorKeyFrame KeyTime="0:0:0" Value="#787979"/>
                <LinearColorKeyFrame KeyTime="0:0:2" Value="#FFFFFF"/>
            </ColorAnimationUsingKeyFrames>
</Storyboard>

当点击按钮时,故事板在代码隐藏中启动。按钮定义如下:

<Button x:Name="answerMainContainer" Tapped="AnswerMainContainer_Tapped" HorizontalAlignment="Center" VerticalAlignment="Center" Height="52" Background="Transparent" Margin="0 0 0 20" Padding="0" MaxWidth="520" MinWidth="180" Style="{StaticResource TransparentButton}">
        <Button.RenderTransform>
            <CompositeTransform TranslateX="0"/>
        </Button.RenderTransform>
        <Border x:Name="answerContainer" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent" BorderBrush="#EBEBEB" BorderThickness="2" Height="48" CornerRadius="24" MaxWidth="520" Padding="10" Margin="0" MinWidth="180">
            <TextBlock x:Name="answer" Text="{Binding Response}" Foreground="#787979" FontSize="16" FontFamily="{ThemeResource Regular}" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
        </Border>
</Button>

我的问题是3色动画没有同步播放,我不知道为什么。我看不出XAML有任何问题。 所以如果有人知道这件事,我会非常高兴的。 提前谢谢

我正在运行Windows101909

安装的NuGet软件包包括:

  • Microsoft.NETCore.UniversalWindowsPlatform v6.2.9
  • Win2D.uwp v1.24.0
  • Microsoft.Toolkit.Uwp.UI.Animations v6.0.0
  • Microsoft.Toolkit.Uwp.UI.Controls v6.0.0
编辑:

社区测试结果

好的,在检查另一个系统后,我发现同样的问题正在发生。 但是,在将背景开始值和动画值的透明颜色更改为纯白色后,问题似乎得到了解决

所以我猜要么是透明色和标准色动画有问题,要么是我的两个系统都损坏了;)

所以现在,我的解决方案是: 将透明颜色更改为普通颜色


谢谢您的帮助。

我测试了上述代码,效果很好,可以分享一段关于您的问题的视频吗?@NicoZhu MSFT链接到上传的视频。我把按键时间从2秒改为0.2秒,因为坏的影响更明显。谢谢你们的关注抱歉,伙计们,我想不出3色动画没有与你们的视频同步播放。请查看带有2s动画的新视频,如我的答案中的代码所示。首先设置边界笔刷的动画。然后发短信。最后,按钮的背景色甚至没有线性效果…问题只发生在1909年?我在1909年进行了测试,请检查你问题中我的屏幕截图。