.netコードからストーリーボードを停止して再起動する適切な方法は何ですか?WPFストーリーボードの再起動
私は
myStory.Stop(this);
は.Begin(この)への後続の呼び出しを期待...しようとしています。タイムラインからゼロで再開するのではなく、ストーリーボードが停止したところでストーリーボードをピックアップします。
私は
.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は、実際に新しく開始されたストーリーボードの上に果たしています。元の(最初の画面からの)ストーリーボードは、私が削除しても、まだ周りにいて演奏されていて、止めました。
多分それは私のセットアップです。もう少し詳しい情報があります。私はstoryOverlayストーリーボードのプロパティを持つbaseclassを持っています。子クラスのctorで、私はストーリーボードとしてstoryOverlay = TryFindResource( "storyId")を行います。 それから、storyOVerlay!= nullであるかどうかを確認しています。 {storyOverlay.Remove(this); } これは何も変わりませんか? – ScottCate