This example shows how to specify the FillBehavior for the inactive Timeline of an animated property.

The FillBehavior property of a Timeline determines what happens to the value of an animated property when it is not being animated, that is, when the Timeline is inactive but its parent 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?

One Timeline has a FillBehavior that is set to Stop, which causes the width of the rectangle to revert back to its non-animated value when the Timeline ends. The other Timeline has a FillBehavior of HoldEnd, which causes the width to remain at its end value when the Timeline ends.

<Pagexmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><StackPanelMargin="20"><BorderBackground="#99FFFFFF"><TextBlockMargin="20">
This example shows how the FillBehavior property determines how an animation behaves
after it reaches the end of its duration.
</TextBlock></Border><TextBlock>FillBehavior="Deactivate"</TextBlock><RectangleName="deactiveAnimationRectangle"Width="20"Height="20"Fill="#AA3333FF"HorizontalAlignment="Left"><Rectangle.Triggers><EventTriggerRoutedEvent="Rectangle.Loaded"><BeginStoryboard><Storyboard><!-- The animated rectangle's width reverts back to its non-animated value
after the animation ends. --><DoubleAnimationStoryboard.TargetName="deactiveAnimationRectangle"Storyboard.TargetProperty="Width"From="100"To="400"Duration="0:0:2"FillBehavior="Stop"/></Storyboard></BeginStoryboard></EventTrigger></Rectangle.Triggers></Rectangle><TextBlockMargin="0,20,0,0">FillBehavior="HoldEnd" </TextBlock><RectangleName="holdEndAnimationRectangle"Width="20"Height="20"Fill="#AA3333FF"HorizontalAlignment="Left"><Rectangle.Triggers><EventTriggerRoutedEvent="Rectangle.Loaded"><BeginStoryboard><Storyboard><!-- The animated rectangle's width remains at its end value after the
animation ends. --><DoubleAnimationStoryboard.TargetName="holdEndAnimationRectangle"Storyboard.TargetProperty="Width"From="100"To="400"Duration="0:0:2"FillBehavior="HoldEnd"/></Storyboard></BeginStoryboard></EventTrigger></Rectangle.Triggers></Rectangle></StackPanel></Page>