Storyboard.Seek Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Moves the storyboard to the specified animation position. The storyboard performs the requested seek when the next clock tick occurs.
Assembly: System.Windows (in System.Windows.dll)
Parameters
- offset
- Type: System.TimeSpan
A positive or negative time value that describes the amount by which the timeline should move forward or backward from the beginning of the animation. By using the TimeSpan Parse behavior, a TimeSpan can be specified as a string in the following format (in this syntax, the [] characters denote optional components of the string, but the quotes, colons, and periods are all a literal part of the syntax):
"[days.]hours:minutes:seconds[.fractionalSeconds]"
- or -
"days"
The following example shows how to use the Seek method. When you tap the rectangle created by the following XAML, the animation jumps to 3 seconds from the beginning of the animation.
<StackPanel>
<StackPanel.Resources>
<Storyboard x:Name="myStoryboard">
<DoubleAnimation
Storyboard.TargetName="MyAnimatedRectangle"
Storyboard.TargetProperty="Width"
From="50" To="550" Duration="0:0:5" />
</Storyboard>
</StackPanel.Resources>
<Rectangle
x:Name="MyAnimatedRectangle"
Width="50"
Height="100"
Fill="Blue"
MouseLeftButtonDown="SeekStoryboard"/>
</StackPanel>
Show: