Timeline.BeginTime Propiedad

Definición

Obtiene o establece la hora a la que debe empezar 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)

Valor de propiedad

Hora a la que debe empezar Timeline con respecto a su propiedad BeginTime primaria.The time at which this Timeline should begin, relative to its parent's BeginTime. Si esta escala de tiempo es una escala de tiempo raíz, la hora es relativa a su hora de inicio interactiva (el momento en el que se activó la escala de tiempo).If this timeline is a root timeline, the time is relative to its interactive begin time (the moment at which the timeline was triggered). Este valor puede ser positivo, negativo o null; un valor null indica que la escala de tiempo nunca se reproduce.This value may be positive, negative, or null; a null value means the timeline never plays. El valor predeterminado es cero.The default value is zero.

Ejemplos

La propiedad de BeginTime una escala de tiempo determina el principio del período activo de una escala de tiempo.A timeline's BeginTime property determines the beginning of a timeline's active period. Si la escala de tiempo tiene una escala de BeginTime tiempo primaria, la propiedad determina cuánto tiempo tarda en iniciarse la escala de tiempo después de que se inicie su elemento primario.If the timeline has a parent timeline, the BeginTime property determines how long it takes the timeline to start after its parent starts. Si la escala de tiempo es una escala de Storyboardtiempo raíz (por ejemplo, BeginTime ), la propiedad determina cuánto tiempo tarda la escala de tiempo en comenzar a reproducirse después de desencadenarse.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.

En el ejemplo siguiente se muestran varias escalas de BeginTime tiempo con distintas configuraciones.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>

Comentarios

La BeginTime propiedad es útil para crear escalas de tiempo que se reproducen en una BeginTime secuencia: al aumentar el número de escalas de tiempo sucesivas que comparten el mismo elemento primario, se pueden escalonar los tiempos de reproducción.The 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.

Valores negativosNegative Values

Un valor BeginTime negativo hace que Timeline un se comporte como si se iniciara en algún momento del pasado.A negative BeginTime value causes a Timeline to behave as though it started at some time in the past. Por ejemplo, cuando Timeline se inicia BeginTime , un con un de 2,5 Duration segundos negativos y un de 5 segundos parecerá estar terminado.For 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 y SpeedRatioBeginTime and SpeedRatio

El tiempo descrito por la BeginTime propiedad se mide en el tiempo de parent's de la escala de tiempo.The time described by the BeginTime property is measured in the timeline's parent's time. Por ejemplo, una escala de tiempo BeginTime con un de 5 cuyo primario SpeedRatio tiene un de 2 se inicia realmente después de 2,5 segundos.For example, a timeline with a BeginTime of 5 whose parent has a SpeedRatio of 2 actually starts after 2.5 seconds.

La SpeedRatio configuración de una escala de tiempo no afecta BeginTimea su.A timeline's own SpeedRatio setting does not affect its BeginTime. Por ejemplo, una escala de tiempo BeginTime con un de 5 segundos SpeedRatio , un de 2 y una escala de tiempo SpeedRatio primaria con un de 1 se inicia después de 5 segundos, no 2,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.

Información sobre propiedades de dependenciaDependency Property Information

Campo de identificadorIdentifier field BeginTimeProperty
Propiedades de metadatos establecidas entrueMetadata properties set to true NingunaNone

Uso de atributos XAMLXAML Attribute Usage

<objeto de = "[-] [días]. BeginTime horas:minutos:segundos[. fractionalSeconds] "/><object BeginTime="[-][days.]hours:minutes:seconds[.fractionalSeconds]"/>

O bien-or-

<objeto de = "[-] [días]. BeginTime horas:minutos"/><object BeginTime="[-][days.]hours:minutes"/>

O bien-or-

<objeto de = "[-] días"/>** BeginTime<object BeginTime="[-]days"/>

o bien-or-

<objeto de = "{x:null Markup Extension}"/> BeginTime<object BeginTime="{x:Null Markup Extension}"/>

Valores XAMLXAML Values

Los elementos entre corchetes[ ( ]y) son opcionales.Items in square brackets ([ and ]) are optional.

durantedays
System.Int32

Valor mayor o igual que 0 que describe el número de días que abarca esta hora de inicio.A value greater than or equal to 0 that describes the number of days spanned by this begin time.

despuéshours
System.Int32

Valor comprendido entre 0 y 23 que representa el número de horas distribuidas por esta hora de inicio.A value between 0 and 23 that represents the number of hours spanned by this begin time.

tiempominutes
System.Int32

Valor comprendido entre 0 y 59 que representa el número de minutos que abarca esta hora de inicio.A value between 0 and 59 that represents the number of minutes spanned by this begin time.

sseconds
System.Int32

Valor comprendido entre 0 y 59 que representa el número de segundos que abarca esta hora de inicio.A value between 0 and 59 that represents the number of seconds spanned by this begin time.

fractionalSecondsfractionalSeconds
System.Int32

Un valor que consta de 1 a 7 dígitos que representa las fracciones de segundo.A value consisting of 1 to 7 digits that represents fractional seconds.

Para obtener la TimeSpan sintaxis completa, consulte la sección Comentarios de Parse la página.For the complete TimeSpan syntax, see the Remarks section of the Parse page.

Se aplica a

Consulte también: