Timeline.BeginTime プロパティ

定義

この Timeline を開始する時間を取得または設定します。Gets or sets the time at which this Timeline should begin.

public:
 property Nullable<TimeSpan> BeginTime { Nullable<TimeSpan> get(); void set(Nullable<TimeSpan> value); };
public Nullable<TimeSpan> BeginTime { get; set; }
member this.BeginTime : Nullable<TimeSpan> with get, set
Public Property BeginTime As Nullable(Of TimeSpan)

プロパティ値

この Timeline を開始する時間 (親の BeginTime に対する相対的な時間)。The time at which this Timeline should begin, relative to its parent's BeginTime. このタイムラインがルート タイムラインの場合は、対話による開始時間 (タイムラインがトリガーされた時間) に対する相対的な時間になります。If this timeline is a root timeline, the time is relative to its interactive begin time (the moment at which the timeline was triggered). この値には、正の値、負の値、または null を指定できます。値が null の場合、そのタイムラインは再生されません。This value may be positive, negative, or null; a null value means the timeline never plays. 既定値は 0 です。The default value is zero.

タイムラインのBeginTimeプロパティは、タイムラインのアクティブな期間の開始を決定します。A timeline's BeginTime property determines the beginning of a timeline's active period. タイムラインに親タイムラインがある場合BeginTime 、プロパティは、その親が開始された後にタイムラインが開始されるまでの時間を決定します。If the timeline has a parent timeline, the BeginTime property determines how long it takes the timeline to start after its parent starts. タイムラインがルートタイムライン ( Storyboardなど) の場合、プロパティはBeginTime 、タイムラインがトリガーされた後に再生を開始する時間を決定します。If the timeline is a root timeline (a Storyboard, for example), the BeginTime property determines how long the timeline takes to start playing after it is triggered.

次の例では、設定が異なるBeginTime複数のタイムラインを示します。The following example shows several different timelines with different BeginTime settings.

<!-- This example shows how the BeginTime property determines when a timeline starts.
     Several rectangles are animated by DoubleAnimations with identical 
     durations and target values, but with different
     BeginTime settings. -->
     
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="BeginTime Example">
  <StackPanel Margin="20">

    <!-- The rectangles to animate. -->
    <Rectangle Name="DefaultBeginTimeRectangle" 
      Width="20" Height="20" Fill="Blue"  />
      
    <Rectangle Name="DelayedBeginTimeRectangle" 
      Width="20" Height="20" Fill="Blue"  />
    
    <Rectangle Name="DelayedAnimationWithDelayedParentRectangle" 
      Width="20" Height="20" Fill="Blue"  /> 

    <Rectangle Name="NegativeBeginTimeExampleRectangle" 
      Width="20" Height="20" Fill="Blue"  />            
    
    <!-- Create a button to start the animations. -->
    <Button Margin="20" Content="Start Animations">
      <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
          <BeginStoryboard>
            <Storyboard>

              <!-- This animation starts as soon as the button is clicked, because it
                   has a BeginTime of 0. -->
              <DoubleAnimation 
                Storyboard.TargetName="DefaultBeginTimeRectangle" 
                Storyboard.TargetProperty="Width"
                BeginTime="0:0:0" From="100" To="600" Duration="0:0:5"  /> 

              <!-- This animation starts 5 seconds after the button is clicked. -->
              <DoubleAnimation 
                Storyboard.TargetName="DelayedBeginTimeRectangle" 
                Storyboard.TargetProperty="Width"  
                BeginTime="0:0:5" From="100" To="600" Duration="0:0:5" />
                
              <ParallelTimeline BeginTime="0:0:5">  

              <!-- This animation starts 10 seconds after the button is clicked, 
                   because its parent has a BeginTime of 5 seconds and it has
                   a BeginTime of 5 seconds: 5 + 5 = 10.  -->              
                <DoubleAnimation  
                  Storyboard.TargetName="DelayedAnimationWithDelayedParentRectangle" 
                  Storyboard.TargetProperty="Width" 
                  BeginTime="0:0:5" From="100" To="600" Duration="0:0:5"  />
              </ParallelTimeline>
              
              <!-- This animation starts as soon as the button is clicked, but
                   it animates from 350 to 600 instead of from 100 to 600 
                   because of its negative BeginTime. The negative BeginTime
                   setting advances the animation, so that it behaves as though
                   it had already been playing for 2.5 seconds as soon as it is
                   started. -->
              <DoubleAnimation 
                Storyboard.TargetName="NegativeBeginTimeExampleRectangle" 
                Storyboard.TargetProperty="Width"  
                BeginTime="-0:0:2.5" From="100" To="600" Duration="0:0:5" />              
              
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Button.Triggers>      
    </Button>
    
    <!-- This example demonstrates how the BeginTime property works on a root timeline. -->
    <Rectangle Name="RootTimelineWithDelayedBeginTimeRectangle"
      Width="20" Height="20" Fill="Blue" >
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.MouseLeftButtonDown">
          <BeginStoryboard>
            <Storyboard BeginTime="0:0:5">
            
              <!-- This animation starts 5 seconds after the left mouse button
                   is pressed, because its parent storyboard (a root timeline)
                   has a BeginTime of 5 seconds. -->
              <DoubleAnimation 
                Storyboard.TargetName="RootTimelineWithDelayedBeginTimeRectangle" 
                Storyboard.TargetProperty="Width"
                BeginTime="0:0:0" From="100" To="600" Duration="0:0:2" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>    
  </StackPanel>
</Page>

注釈

プロパティは、シーケンス内で再生されるタイムラインを作成する場合にBeginTime便利です。同じ親を共有するタイムラインのを増やすことで、再生時間をずらすことができます。 BeginTimeThe BeginTime property is useful for creating timelines that play in a sequence: by increasing the BeginTime of successive timelines that share the same parent, you can stagger their play times.

負の値Negative Values

BeginTimeの値を指定Timelineすると、は過去のある時点で開始されたかのように動作します。A negative BeginTime value causes a Timeline to behave as though it started at some time in the past. たとえばTimeline Duration 、が負の2.5秒で、が5秒の場合は、開始時に半方向の完了のように見えます。BeginTimeFor example, a Timeline with a BeginTime of negative 2.5 seconds and a Duration of 5 seconds will appear to be half-way finished when it starts.

BeginTime と System.windows.media.animation.timeline.speedratioBeginTime and SpeedRatio

BeginTimeプロパティによって示される時間は、タイムラインの parent's で測定されます。The time described by the BeginTime property is measured in the timeline's parent's time. たとえば、が5であるタイムBeginTimeラインは、親SpeedRatioが2である場合、2.5 秒の後に実際に開始されます。For example, a timeline with a BeginTime of 5 whose parent has a SpeedRatio of 2 actually starts after 2.5 seconds.

タイムラインの独自SpeedRatioの設定は、 BeginTimeには影響しません。A timeline's own SpeedRatio setting does not affect its BeginTime. たとえば、が5秒で、 BeginTimeSpeedRatio 2 で、親タイムラインSpeedRatioが1である場合、2.5 ではなく5秒後に開始します。For example, a timeline with a BeginTime of 5 seconds, a SpeedRatio of 2, and a parent timeline with a SpeedRatio of 1 starts after 5 seconds, not 2.5.

依存プロパティ情報Dependency Property Information

識別子フィールドIdentifier field BeginTimeProperty
メタデータプロパティがに設定されるtrueMetadata properties set to true NoneNone

XAML 属性の使用方法XAML Attribute Usage

<オブジェクト= "[-] [days.] BeginTime時間::[。fractionalSeconds] "/><object BeginTime="[-][days.]hours:minutes:seconds[.fractionalSeconds]"/>

または-or-

<オブジェクト= "[-] [days.] BeginTime時間:"/><object BeginTime="[-][days.]hours:minutes"/>

- または --or-

<object BeginTime="[-]days"/><object BeginTime="[-]days"/>

- または --or-

<オブジェクト= "{x:Null Markup Extension}"/> BeginTime<object BeginTime="{x:Null Markup Extension}"/>

XAML 値XAML Values

角かっこ ([および]) の項目は省略可能です。Items in square brackets ([ and ]) are optional.

daysdays
System.Int32

この開始時刻にまたがる日数を示す0以上の値です (0 以上)。A value greater than or equal to 0 that describes the number of days spanned by this begin time.

までhours
System.Int32

この開始時刻にまたがる時間数を表す 0 ~ 23 の値。A value between 0 and 23 that represents the number of hours spanned by this begin time.

~minutes
System.Int32

この開始時間の間隔を分単位で表した 0 ~ 59 の値。A value between 0 and 59 that represents the number of minutes spanned by this begin time.

secondsseconds
System.Int32

この開始時刻にまたがる秒数を表す 0 ~ 59 の値。A value between 0 and 59 that represents the number of seconds spanned by this begin time.

fractionalSecondsfractionalSeconds
System.Int32

秒の小数部を表す 1 ~ 7 桁の数字で構成される値。A value consisting of 1 to 7 digits that represents fractional seconds.

完全なTimeSpan構文については、このParseページの「解説」を参照してください。For the complete TimeSpan syntax, see the Remarks section of the Parse page.

適用対象

こちらもご覧ください