What is the proper way to stop and restart a storyboard from .net code?
I'm trying ...
myStory.Stop(this);
Expecting that a subsequent call to .Begin(this); would restart from the timeline at zero, but instead, the storyboard picks up right where it was stopped.
I have tried
.Remove(this);
and I tried
.Seek(TimeSpan.Zero);
which also didn't work.
More details ... Here is my storyboard sample.
<Storyboard x:Key="overlay">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textone" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:03.0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:03.0" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:06.0" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:06.0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="texttwo" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:07.0" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:07.0" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:10.0" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:10.0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
So the text in the textone runs, and if you close the screen, and return to the screen quickly, the texttwo, actually plays over a newly started storyboard. So the original (from the first screen) storyboard is still around and playing, even though I've removed, and stopped it.