* 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
2.6 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||
|---|---|---|---|---|---|---|---|---|
| How to: Animate a Property by Using an AnimationClock | 03/30/2017 |
|
|
e6542021-714c-4675-9567-04f1c7380834 |
How to: Animate a Property by Using an AnimationClock
This example shows how to use xref:System.Windows.Media.Animation.Clock objects to animate a property.
There are three ways to animate a dependency property:
-
Create an xref:System.Windows.Media.Animation.AnimationTimeline and associate it with that property by using a xref:System.Windows.Media.Animation.Storyboard.
-
Use the object's xref:System.Windows.Media.Animation.Animatable.BeginAnimation%2A method to apply a single xref:System.Windows.Media.Animation.AnimationTimeline to a target property.
-
Create an xref:System.Windows.Media.Animation.AnimationClock from an xref:System.Windows.Media.Animation.AnimationTimeline and apply it to a property.
xref:System.Windows.Media.Animation.Storyboard objects and the xref:System.Windows.Media.Animation.Animatable.BeginAnimation%2A method enable you to animate properties without directly creating and distributing clocks (for examples, see Animate a Property by Using a Storyboard and Animate a Property Without Using a Storyboard); clocks are created and distributed for you automatically.
Example
The following example shows how to create an xref:System.Windows.Media.Animation.AnimationClock and apply it to two similar properties.
[!code-csharptimingbehaviors_procedural_snip#GraphicsMMCreateAnimationClockWholeClass] [!code-vbtimingbehaviors_procedural_snip#GraphicsMMCreateAnimationClockWholeClass]
For an example showing how to interactively control a xref:System.Windows.Media.Animation.Clock after it starts, see Interactively Control a Clock.