title | description | ms.date | helpviewer_keywords | ms.assetid | ||
---|---|---|---|---|---|---|
How to: Specify the FillBehavior for a Timeline that has Reached the End of Its Active Period |
Learn how the FillBehavior property of a Timeline determines what happens to the value of an animated property when the Timeline is inactive. |
03/30/2017 |
|
db805f59-d513-4dac-af15-47005dae3199 |
This example shows how to specify the xref:System.Windows.Media.Animation.Timeline.FillBehavior%2A for the inactive xref:System.Windows.Media.Animation.Timeline of an animated property.
The xref:System.Windows.Media.Animation.Timeline.FillBehavior%2A property of a xref:System.Windows.Media.Animation.Timeline determines what happens to the value of an animated property when it is not being animated, that is, when the xref:System.Windows.Media.Animation.Timeline is inactive but its parent xref:System.Windows.Media.Animation.Timeline is inside its active or hold period. For example, does an animated property remain at its end value after the animation ends or does it revert back to the value it had before the animation started?
The following example uses a xref:System.Windows.Media.Animation.DoubleAnimation to animate the xref:System.Windows.FrameworkElement.Width%2A of two rectangles. Each rectangle uses a different xref:System.Windows.Media.Animation.Timeline object.
One xref:System.Windows.Media.Animation.Timeline has a xref:System.Windows.Media.Animation.Timeline.FillBehavior%2A that is set to xref:System.Windows.Media.Animation.FillBehavior.Stop, which causes the width of the rectangle to revert back to its non-animated value when the xref:System.Windows.Media.Animation.Timeline ends. The other xref:System.Windows.Media.Animation.Timeline has a xref:System.Windows.Media.Animation.Timeline.FillBehavior%2A of xref:System.Windows.Media.Animation.FillBehavior.HoldEnd, which causes the width to remain at its end value when the xref:System.Windows.Media.Animation.Timeline ends.
[!code-xamltimingbehaviors_snip#FillBehaviorWholePage]
For the complete sample, see Animation Example Gallery.
- xref:System.Windows.Media.Animation.DoubleAnimation
- xref:System.Windows.FrameworkElement.Width%2A
- xref:System.Windows.Media.Animation.Timeline
- xref:System.Windows.Media.Animation.Timeline.FillBehavior%2A
- xref:System.Windows.Media.Animation.FillBehavior.Stop
- xref:System.Windows.Media.Animation.FillBehavior.HoldEnd
- Animation Overview
- Animation and Timing How-to Topics