croxy croxy - 1 month ago 20
C# Question

How to animate the width and height of an ellipse in an UWP app

I'm trying to animate the width and height property of an

Ellipse
element in XAML. I found a few examples online, but none of them seems to work.

I'm sure I'm missing only something little and stupid. Here my animation in xaml:

<Page.Resources>
<Storyboard x:Name="PressFormLogin" Storyboard.TargetName="OuterEllipse">
<DoubleAnimation Storyboard.TargetProperty="Width" From="259.0" To="149.0" Duration="0:0:5" />
<DoubleAnimation Storyboard.TargetProperty="Height" From="259.0" To="149.0" Duration="0:0:5" />
</Storyboard>
</Page.Ressources>


The
Ellipse
element in XAML:

<Ellipse x:Name="OuterEllipse" Width="259" Height="259" Fill="#FF5AA1BA" />


And how I try to start the animation in the code behind:

PressFormLogin.Begin();


It's the first time that I'm using a animation in one of my applications, it would be nice if someone could give me a push in the right direction.

Answer

Try to set EnableDependentAnimation="True" for your DoubleAnimation. See EnableDependentAnimation on MSDN.

Comments