Cet article a fait l'objet d'une traduction manuelle. Déplacez votre pointeur sur les phrases de l'article pour voir la version originale de ce texte.
Traduction
Source
Ce sujet n'a pas encore été évalué - Évaluez ce sujet

Timeline.FillBehavior, propriété

Obtient ou définit une valeur qui spécifie le comportement du Timeline une fois qu'il a atteint la fin de sa période active.

Espace de noms :  System.Windows.Media.Animation
Assembly :  PresentationCore (dans PresentationCore.dll)
XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public FillBehavior FillBehavior { get; set; }
<object FillBehavior="FillBehavior" .../>

Valeur de propriété

Type : System.Windows.Media.Animation.FillBehavior
Valeur qui spécifie le comportement de la chronologie une fois qu'elle a atteint la fin de sa période active, alors que son parent se trouve dans sa période active ou de remplissage. La valeur par défaut est HoldEnd.

Champ d'identificateur

FillBehaviorProperty

Propriétés de métadonnées ayant la valeur true

Aucun

Affectez HoldEnd à la propriété FillBehavior d'une animation pour que celle-ci conserve sa valeur une fois qu'elle a atteint la fin de sa période active. Une animation qui a atteint la fin de sa période active et qui possède un paramètre FillBehavior ayant la valeur HoldEnd est considérée comme étant dans sa période de remplissage. Si vous ne souhaitez pas qu'une animation conserve sa valeur une fois qu'elle a atteint la fin de sa période active, affectez

Stop à sa propriété FillBehavior.

Comme une animation qui se trouve dans sa période de remplissage continue à substituer la valeur de sa propriété cible, toute tentative de définition de la valeur de la propriété cible par d'autres moyens risque de n'avoir aucun effet. Pour obtenir un exemple de définition d'une valeur de propriété une fois qu'elle a été animée, consultez Comment : définir une propriété après l'avoir animée avec un storyboard.

Une chronologie enfant arrête de s'accomplir et de se remplir lorsque sa chronologie parente s'arrête ; pour qu'une chronologie enfant se remplisse, assurez-vous que sa chronologie parente possède un FillBehavior ayant la valeur HoldEnd.

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?

The following example uses a DoubleAnimation to animate the Width of two rectangles. Each rectangle uses a different Timeline object.

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.


<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
  <StackPanel Margin="20">
    <Border Background="#99FFFFFF">
      <TextBlock Margin="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>
    <Rectangle Name="deactiveAnimationRectangle" Width="20" Height="20" Fill="#AA3333FF" HorizontalAlignment="Left" >
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.Loaded">
          <BeginStoryboard>
            <Storyboard>

              <!-- The animated rectangle's width reverts back to its non-animated value
                   after the animation ends. -->
              <DoubleAnimation 
                Storyboard.TargetName="deactiveAnimationRectangle" 
                Storyboard.TargetProperty="Width" 
                From="100" To="400" Duration="0:0:2" FillBehavior="Stop" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>

    <TextBlock Margin="0,20,0,0">FillBehavior="HoldEnd" </TextBlock>
    <Rectangle Name="holdEndAnimationRectangle" Width="20" Height="20" Fill="#AA3333FF" HorizontalAlignment="Left" >
      <Rectangle.Triggers>
        <EventTrigger RoutedEvent="Rectangle.Loaded">
          <BeginStoryboard>
            <Storyboard>

              <!-- The animated rectangle's width remains at its end value after the 
                   animation ends. -->
              <DoubleAnimation Storyboard.TargetName="holdEndAnimationRectangle" 
                Storyboard.TargetProperty="Width"  
                From="100" To="400" Duration="0:0:2" FillBehavior="HoldEnd" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Rectangle.Triggers>
    </Rectangle>
  </StackPanel>
</Page>


For the complete sample, see Animation Example Gallery.

.NET Framework

Pris en charge dans : 4, 3.5, 3.0

.NET Framework Client Profile

Pris en charge dans : 4, 3.5 SP1

Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2

Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Cela vous a-t-il été utile ?
(1500 caractères restants)
Contenu de la communauté Ajouter
Annotations FAQ