Files
Andy De George da363692ff Initial WPF content migrated (#17)
* 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
2020-09-04 09:46:28 -07:00

2.6 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
How to: Repeat an Animation 03/30/2017
RepeatBehavior property of timelines [WPF]
repeating animating [WPF]
Timelines RepeatBehavior property [WPF]
animation [WPF], repeating
e6f3b068-eeeb-47fd-8d40-8848c31f1e1e

How to: Repeat an Animation

This example shows how to use the xref:System.Windows.Media.Animation.Timeline.RepeatBehavior%2A property of a xref:System.Windows.Media.Animation.Timeline in order to control the repeat behavior of an animation.

Example

The xref:System.Windows.Media.Animation.Timeline.RepeatBehavior%2A property of a xref:System.Windows.Media.Animation.Timeline controls how many times an animation repeats its simple duration. By using xref:System.Windows.Media.Animation.Timeline.RepeatBehavior%2A, you can specify that a xref:System.Windows.Media.Animation.Timeline repeats for a certain number of times (an iteration count) or for a specified time period. In either case, the animation goes through as many beginning-to-end runs that it needs in order to fill the requested count or duration.

By default, timelines have a repeat count of 1.0, which means they play one time and do not repeat. However, if you set the xref:System.Windows.Media.Animation.Timeline.RepeatBehavior%2A property of a xref:System.Windows.Media.Animation.Timeline to xref:System.Windows.Media.Animation.RepeatBehavior.Forever%2A, the timeline repeats indefinitely.

The following example shows how to use the xref:System.Windows.Media.Animation.Timeline.RepeatBehavior%2A property to control the repeat behavior of an animation. The example animates the xref:System.Windows.FrameworkElement.Width%2A property of five rectangles with each rectangle using a different type of repeat behavior.

[!code-xamltimingbehaviors_snip#RepeatBehaviorWholePage]

For the complete sample, see Animation Timing Behavior Sample.

See also