Timeline.Duration Timeline.Duration Timeline.Duration Timeline.Duration Property

定義

取得或設定這個時間表播放的時間長度 (不計算重複次數)。Gets or sets the length of time for which this timeline plays, not counting repetitions.

public:
 property System::Windows::Duration Duration { System::Windows::Duration get(); void set(System::Windows::Duration value); };
public System.Windows.Duration Duration { get; set; }
member this.Duration : System.Windows.Duration with get, set
Public Property Duration As Duration

屬性值

時刻表的簡單持續期間:這個時刻表完成單一向前反覆項目所花費的時間量。The timeline's simple duration: the amount of time this timeline takes to complete a single forward iteration. 預設值為 AutomaticThe default value is Automatic.

範例

ParallelTimelineStoryboard是物件的TimelineGroup類型。ParallelTimeline and Storyboard are types of TimelineGroup objects. 的持續時間TimelineGroup取決於其子時間軸的持續時間。The duration of a TimelineGroup is determined by the duration of its child timelines. 例如, Storyboard下列程式會執行六秒 (持續時間6秒), 因為這是最後一個子時間軸 (DoubleAnimation) 結束時。For example, the Storyboard below will run for six seconds (duration of 6 seconds) because that is when its last child Timeline (DoubleAnimation) ends.

注意

注意: 下列範例已省略程式碼, 僅提供給說明制定目的。Note: code has been omitted from the following examples, which are provided for illustrative purposed only.

[xaml][xaml]

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

> 動畫<類型的範例包括DoubleAnimationPointAnimationColorAnimation等。如果未Duration指定這些動畫類型的, 則會執行一秒。Examples of <Type>Animations include DoubleAnimation, PointAnimation, ColorAnimation, etc. If no Duration is specified for these types of animations, they will run for one second.

[xaml][xaml]

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

> AnimationUsingKeyFrames <類型的範例包括DoubleAnimationUsingKeyFramesPointAnimationUsingKeyFrames等。如果未Duration指定這些動畫類型的, 則會執行, 直到所有主要畫面格都完成為止。Examples of <Type>AnimationUsingKeyFrames include DoubleAnimationUsingKeyFrames, PointAnimationUsingKeyFrames, etc. If no Duration is specified for these types of animations they will run until all key frames are finished.

[xaml][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>   
...  

備註

時間軸的簡單持續時間會構成單次向前反復專案與總播放時間 (包括重複) 的時間。A timeline's simple duration constitutes the time for a single forward iteration versus the total play time, which includes repetitions.

預設持續時間行為Default Duration Behavior

值為之Duration Automatic結構的行為取決於時間軸的類型:The behavior of a Duration structure with a value of Automatic depends on the type of timeline:

時限Timeline BehaviorBehavior
Timeline 不確定Timeline (是抽象的)Undetermined (Timeline is abstract)
ParallelTimeline,ParallelTimeline,

Storyboard,Storyboard,

TimelineGroup
展開以符合子時間軸Expands to fit child timelines
<輸入> 動畫 (稱為「From/To/By」或「基本」動畫)<Type>Animation (Known as a "From/To/By" or "basic" animations) 1秒1 second
<類型> AnimationUsingKeyFrames (稱為主要畫面格動畫)<Type>AnimationUsingKeyFrames (Known as key frame animations) 所有主要畫面KeyTime格值的總和Sum of all key frame KeyTime values

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field DurationProperty
中繼資料屬性設定為trueMetadata properties set to true None

適用於

另請參閱