1

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?

2 Answers 2

4

When using Begin, Set the second parameter (IsControllable) to true in order to make the Stop method work:

_wheelAnimation.Begin(this, true);
_wheelAnimation.Stop(this);
-1

Try _wheelAnimation.SkipToFill();

2
  • 1
    Not working. See that it's a repetitive animation (Forever one)
    – Sonhja
    Jun 17, 2015 at 11:24
  • What about .Remove()?
    – Ben Cohen
    Jun 17, 2015 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.