Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 2.96 KB

specify-the-fillbehavior-for-a-timeline.md

File metadata and controls

35 lines (26 loc) · 2.96 KB
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
FillBehavior property for inactive timelines [WPF]
Timelines [WPF], FillBehavior property
db805f59-d513-4dac-af15-47005dae3199

How to: Specify the FillBehavior for a Timeline that has Reached the End of Its Active Period

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.

Example

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.

See also

  • 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