I have an animation in UWP app which was working (Production Windows Store app) as intended until Windows Update 1809. Something was changed and now the animation resets to From
value right after it finished.
Example code:
Animation (rotation):
<Storyboard x:Key="FlipTest">
<DoubleAnimation
Storyboard.TargetName="TestRotation"
Storyboard.TargetProperty="RotationY"
From="180"
To="10"
Duration="0:0:1.40"
/>
</Storyboard>
Animated item:
<TextBlock Text="Test" FontSize="18">
<TextBlock.Projection>
<PlaneProjection x:Name="TestRotation" RotationY="0" />
</TextBlock.Projection>
</TextBlock>
Call to start from button click:
private void Button_Click(object sender, RoutedEventArgs e)
{
Storyboard sb = (Storyboard)Resources["FlipTest"];
sb.Begin();
}
Intended behavior (works on Windows 1803): When you click on the button, the TextBlock rotated and stays in this state.
Behavior on Windows 1809:
The TextBox reset to From
(180 deg) value right after the animation finished, but before Storyboard.Completed
event called.
Interestingly, if I put To="0"
, it stays in this state. If I put 10, 190 or 360 degrees, it resets. Note, it resets not to the original state (which is 0deg), but to From
value (180deg).
I also updated Microsoft.NETCore.UniversalWindowsPlatform
to the latest version (6.1.9), but it changes nothing.
Could anyone explain this behavior or tell how to fix it? Am I missing something obvious?
UPDATE (ugly workaround)
I find out that I can use the following ugly hack:
sb.Completed += (s, ee) =>
{
TestRotation.RotationY = 0.01; // ugly hack for Windows Build 1809
};
But it looks terrible not only in code. On the screen you can see the terrible blink, because after the animation the item resets and then set again to normal value.
I also noticed that RotationY
hold the correct value after animation completed, although visually the item rotated. You can see the value is 0 in code (on complete animation) or in Live Property Explorer
, while visually the item rotated to 180 deg.