May 11, 2014
Gets or sets the time at which this Timeline should begin.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
Dependency property identifier field: BeginTimeProperty
The property is useful for creating timelines that play in a sequence: by increasing the of successive timelines that share the same parent Storyboard, you can stagger their play times.
You can set the value of on a running animation, and the value will apply the next time that animation is started. You can get the value programmatically by using value=object. syntax. However, if the for an animation is not explicitly set (either programmatically or in XAML), the value of object. will be null. A null value for has the same implied effect on an animation as a TimeSpan that is explicitly set to 0.
A negative value causes a Timeline to behave as though it started at some time in the past. For example, a Timeline with a of negative 2.5 seconds and a Duration of 5 seconds will appear to be half-way finished when it starts.
BeginTime and SpeedRatio
The time described by the property is measured in the timeline's parent's time. For example, a timeline with a of 5 whose parent has a SpeedRatio of 2 actually starts after 2.5 seconds.
As the name suggests, the property allows you to specify a time at which point the animation object begins activity. For example, you could specify a time of two seconds on the of a Storyboard. When you begin the Storyboard using the Begin method, the Storyboard will wait two seconds and then begin. In addition you can specify on the animation objects inside of the Storyboard. For example, if you have a Storyboard with a two second and this Storyboard contains two DoubleAnimation objects -- one with no specified and the other with a of three, the first DoubleAnimation will start two seconds after the Begin method is called on the Storyboard and the second DoubleAnimation will begin five seconds afterward (two seconds delay for the Storyboard plus three second delay for the DoubleAnimation). The following example shows this.
<StackPanel> <StackPanel.Resources> <!-- Storyboard starts 2 seconds after its Begin method is called. --> <Storyboard BeginTime="0:0:2" x:Name="myStoryboard"> <!-- Animates the rectangle's width. No BeginTime specified so by default begins as soon as it's parent (the Storyboard) begins. --> <DoubleAnimation Storyboard.TargetName="MyAnimatedRectangle" Storyboard.TargetProperty="Width" To="300" Duration="0:0:1" /> <!-- Animates the rectangle's opacity. A BeginTime of 3 seconds specified so begins three seconds after the Storyboard begins (total of 5 seconds)--> <DoubleAnimation BeginTime="0:0:3" Storyboard.TargetName="MyAnimatedRectangle" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:1" /> </Storyboard> </StackPanel.Resources> <Rectangle x:Name="MyAnimatedRectangle" Loaded="Start_Animation" Width="100" Height="100" Fill="Blue" /> </StackPanel> </StackPanel>
You can think of a Storyboard as a container for other animation objects (e.g. DoubleAnimation) as well as other Storyboard objects, that is, you can nest Storyboard objects within each other and specify values for each Storyboard separately. Using nested Storyboards can help you orchestrate elaborate animation sequences. Each child Storyboard will wait until its parent Storyboard begins and then start the countdown before it in turn begins.