I have the following code to start an animation that it's located in my Resources
:
Storyboard _wheelAnimation = FindResource("CircleRotation") as Storyboard;
if (_wheelAnimation == null) return;
_wheelAnimation.Begin(this);
Here is my animation:
<Storyboard x:Key="CircleRotation" RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="BigWheelImage"
Storyboard.TargetProperty="RenderTransform.Angle"
From="360" To="0" Duration="0:0:35" BeginTime="00:00:00.000" />
<DoubleAnimation
Storyboard.TargetName="SmallWheelImage"
Storyboard.TargetProperty="RenderTransform.Angle"
From="0" To="360" Duration="0:0:25" BeginTime="00:00:00.000" />
</Storyboard>
I want to stop it programmatically, and I tried this:
_wheelAnimation.Stop(); // and also _wheelAnimation.Stop(this);
With no luck... any idea on why it's not stopping?
When using
Begin
, Set the second parameter (IsControllable
) to true in order to make theStop
method work: