I am creating an animation in procedural code. Nothing fancy, it just rotates a canvas.
I initiate the animation like this
TheAnimation.From = 0;
TheAnimation.To = 360;
TheAnimation.RepeatBehavior =
RepeatBehavior.Forever;TheAnimation.Duration =
new Duration(TimeSpan.FromMilliseconds(2000)); // 2 secs per revolutionSpinCanvas.BeginStoryboard(TheStoryboard);
How can I stop it
The sample code in the SDK (How to: Control a Storyboard After It Starts) suggests that this will do the trick, but no dice.
TheStoryboard.Stop(SpinCanvas);Is it taking me too literally on the "Forever" part
Thanks
NIK

Can't stop StoryBoard
JanusKH
The problem is not in the Stop(), but in the Begin().
Note that you are not launching the Storyboard the same way as the sample code in http://windowssdk.msdn.microsoft.com/en-us/ms741997(VS.80).aspx
The critical missing part is: In order for Stop() to work, a Storyboard must be launched with Interactive Control set to true.
To modify your program so that it matches the "How To" article's sample code, change the Storyboard Begin call to become:
TheStoryboard.Begin(SpinCanvas, true);
radarman
You're absolutely correct
Thank you
NIK