从.net代码停止和重新启动情节提要的正确方法是什么?
我正在努力 ...
myStory.Stop(this);
期望随后调用 .Begin(this); 将从零处的时间线重新开始,但故事板会在它停止的地方重新开始。
我试过了
.Remove(this);
我试过了
.Seek(TimeSpan.Zero);
这也没有用。
更多细节......这是我的故事板示例。
<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>
因此 textone 中的文本运行,如果您关闭屏幕并快速返回屏幕,texttwo 实际上会在新启动的故事板上播放。所以最初的(从第一个屏幕)故事板仍然在播放,即使我已经删除并停止了它。