* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
3.1 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|---|
| How to: Control a Storyboard After It Starts | 03/30/2017 |
|
|
040f13f0-69f9-4ab5-be2b-079f4f80c7c0 |
How to: Control a Storyboard After It Starts
This example shows how to use code to control a xref:System.Windows.Media.Animation.Storyboard after it has started. To control a storyboard in [!INCLUDETLA2#tla_xaml], use xref:System.Windows.Trigger and xref:System.Windows.TriggerAction objects; for an example, see Use Event Triggers to Control a Storyboard After It Starts.
To start a storyboard, you use its xref:System.Windows.Media.Animation.Storyboard.Begin%2A method, which distributes the storyboard's animations to the properties they animate and starts the storyboard.
To make a storyboard controllable, you use the xref:System.Windows.Media.Animation.Storyboard.Begin%2A method and specify true as the second parameter. You can then use the storyboard's interactive methods to pause, resume, seek, stop, speed up, or slow down the storyboard, or advance it to its fill period. The following is a list of the storyboard's interactive methods:
-
xref:System.Windows.Media.Animation.Storyboard.Pause%2A: Pauses the storyboard.
-
xref:System.Windows.Media.Animation.Storyboard.Resume%2A: Resumes a paused storyboard.
-
xref:System.Windows.Media.Animation.Storyboard.SetSpeedRatio%2A: Sets the storyboard's interactive speed.
-
xref:System.Windows.Media.Animation.Storyboard.Seek%2A: Seeks the storyboard the specified location.
-
xref:System.Windows.Media.Animation.Storyboard.SeekAlignedToLastTick%2A: Seeks the storyboard to the specified location. Unlike the xref:System.Windows.Media.Animation.Storyboard.Seek%2A method, this operation is processed before the next tick.
-
xref:System.Windows.Media.Animation.Storyboard.SkipToFill%2A: Advances the storyboard to its fill period, if it has one.
-
xref:System.Windows.Media.Animation.Storyboard.Stop%2A: Stops the storyboard.
In the following example, several storyboard methods are used to interactively control a storyboard.
Note
To see an example of controlling a storyboard using triggers with [!INCLUDETLA2#tla_xaml], see Use Event Triggers to Control a Storyboard After It Starts.
Example
[!code-csharptimingbehaviors_procedural_snip#ControlStoryboardExampleUsingWholePage] [!code-vbtimingbehaviors_procedural_snip#ControlStoryboardExampleUsingWholePage]