Timeline.Duration プロパティ

定義

繰り返しをカウントせずに、このタイムラインの再生に要する時間を取得または設定します。

public System.Windows.Duration Duration { get; set; }

プロパティ値

タイムラインの単純継続時間 (このタイムラインが順方向の反復を 1 回完了するのに要する時間)。 既定値は Automatic です。

ParallelTimelineStoryboard はオブジェクトの TimelineGroup 種類です。 の TimelineGroup 期間は、その子タイムラインの期間によって決まります。 たとえば、次の Storyboard は、最後の子タイムライン () が終了したときに 6 秒間 (DoubleAnimation6 秒の継続時間) 実行されます。

注意

注: コードは次の例から省略されています。これは説明のみを目的として提供されています。

[xaml]

...  
  <Storyboard>  
    <DoubleAnimation Duration="0:0:2" …/>  
    <DoubleAnimation Duration="0:0:4" BeginTime="0:0:2" …/>  
  </Storyboard>   
...  

>アニメーションの<例には、、PointAnimationColorAnimation、などが含まれますDoubleAnimation。これらの種類のアニメーションに 対して が指定されていないDuration場合は、1 秒間実行されます。

[xaml]

...  
  <!-- With no Duration specified, this animation will run for   
       one second -->  
  <DoubleAnimation .../>  
...  

AnimationUsingKeyFrames の種類>の<例にはDoubleAnimationUsingKeyFrames、、PointAnimationUsingKeyFramesなどがあります。これらの種類のアニメーションに が指定されていないDuration場合は、すべてのキー フレームが完了するまで実行されます。

[xaml]

...  
  <Storyboard>  

    <!-- This key frame animation will end at 4.5 seconds  
         Because that is when its last KeyFrame KeyTime ends. -->  
    <DoubleAnimationUsingKeyFrames ...>  
      <LinearDoubleKeyFrame ... KeyTime="0:0:3" />  
      <DiscreteDoubleKeyFrame ... KeyTime="0:0:3.5" />  
      <DiscreteDoubleKeyFrame ... KeyTime="0:0:4" />  
      <DiscreteDoubleKeyFrame ... KeyTime="0:0:4.5" />  
    </DoubleAnimationUsingKeyFrames>  
  </Storyboard>   
...  

注釈

タイムラインの単純な期間は、1 回の前方反復の時間と、繰り返しを含む合計再生時間を構成します。

既定の期間の動作

AutomaticDuration の構造体の動作は、タイムラインの種類によって異なります。

タイムライン Behavior
Timeline Undetermined (Timeline is abstract)
ParallelTimeline,

Storyboard,

TimelineGroup
子タイムラインに合わせて展開します
< >アニメーション ("From/To/By" または "basic" アニメーションと呼ばれます) 1 秒
< >AnimationUsingKeyFrames (キー フレーム アニメーションと呼ばれます) すべてのキー フレーム KeyTime 値の合計

依存プロパティ情報

識別子フィールド DurationProperty
に設定されたメタデータ プロパティ true なし

適用対象

製品 バージョン
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

こちらもご覧ください