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
|
RepeatBehavior, structure
Décrit comment un Timeline répète sa durée simple.
Assembly : PresentationCore (dans PresentationCore.dll)
XMLNS pour XAML : http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
[TypeConverterAttribute(typeof(RepeatBehaviorConverter))] public struct RepeatBehavior : IFormattable
<objet propriété="iterationCountx"/>- ou -<objet propriété="[days.]hours:minutes:seconds[.fractionalSeconds]"/>- ou -<objet propriété="[days.]hours:minutes"/>- ou - <objet propriété="days"/>- ou -<objet propriété="Forever"/>
Valeurs XAML
Les éléments figurant entre crochets ([ et ]) sont facultatifs.
Le type RepeatBehavior expose les membres suivants.
| Nom | Description | |
|---|---|---|
|
RepeatBehavior(Double) | Initialise une nouvelle instance de la structure RepeatBehavior avec le nombre d'itérations spécifié. |
|
RepeatBehavior(TimeSpan) | Initialise une nouvelle instance de la structure RepeatBehavior avec la durée de répétition spécifiée. |
| Nom | Description | |
|---|---|---|
|
Count | Obtient le nombre de répétitions attendu d'un Timeline. |
|
Duration | Obtient la durée totale attendue d'un Timeline. |
|
Forever | Obtient un RepeatBehavior qui spécifie un nombre infini de répétitions. |
|
HasCount | Obtient une valeur qui indique si le comportement de répétition a un nombre d'itérations spécifié. |
|
HasDuration | Obtient une valeur qui indique si le comportement de répétition a une durée de répétition spécifiée. |
| Nom | Description | |
|---|---|---|
|
Equals(Object) | Indique si cette instance est égale à l'objet spécifié. (Substitue ValueType.Equals(Object).) |
|
Equals(RepeatBehavior) | Retourne une valeur indiquant si cette instance est égale au RepeatBehavior spécifié. |
|
Equals(RepeatBehavior, RepeatBehavior) | Indique si deux structures RepeatBehavior spécifiées sont de valeur égale. |
|
Finalize | Autorise un objet à tenter de libérer des ressources et d'exécuter d'autres opérations de netto***ge avant qu'il ne soit récupéré par l'opération garbage collection. (Hérité de Object.) |
|
GetHashCode | Retourne le code de hachage de cette instance. (Substitue ValueType.GetHashCode().) |
|
GetType | Obtient le Type de l'instance actuelle. (Hérité de Object.) |
|
MemberwiseClone | Crée une copie superficielle de l'objet Object actif. (Hérité de Object.) |
|
ToString() | Retourne une représentation sous forme de chaîne de cette instance RepeatBehavior. (Substitue ValueType.ToString().) |
|
ToString(IFormatProvider) | Retourne une représentation sous forme de chaîne de cette instance RepeatBehavior avec le format spécifié. |
| Nom | Description | |
|---|---|---|
|
Equality | Indique si les deux instances RepeatBehavior spécifiées sont égales. |
|
Inequality | Indique si les deux instances de RepeatBehavior ne sont pas égales. |
| Nom | Description | |
|---|---|---|
|
IFormattable.ToString | Met en forme la valeur de l'instance en cours à l'aide du format spécifié. |
Il existe trois types de comportements RepeatBehavior :
-
Nombre d'itérations - Spécifie le nombre de répétitions de la durée simple d'un Timeline. Le nombre d'itérations par défaut est 1,0. Cela signifie que le Timeline est précisément actif pour une de ses durées simples. Lorsque le nombre d'itérations équivaut à 0,5, cela signifie que la chronologie est active pour la moitié de sa durée simple. Lorsque le nombre d'itérations équivaut à 2, cela signifie que la chronologie répète deux fois sa durée simple. Pour plus d'informations, consultez la propriété Count.
-
Durée - Spécifie la longueur de la durée active de l'objet Timeline. Par exemple, un Timeline avec une valeur Duration simple de 1 seconde et une valeur RepeatBehavior.Duration de 2,5 secondes est exécuté à raison de 2,5 itérations.
-
Toujours - Le Timeline se répète indéfiniment.
This example shows how to use the RepeatBehavior property of a Timeline in order to control the repeat behavior of an animation.
The RepeatBehavior property of a Timeline controls how many times an animation repeats its simple duration. By using RepeatBehavior, you can specify that a 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 RepeatBehavior property of a Timeline to Forever, the timeline repeats indefinitely.
The following example shows how to use the RepeatBehavior property to control the repeat behavior of an animation. The example animates the Width property of five rectangles with each rectangle using a different type of repeat behavior.
<!-- RepeatBehaviorExample.xaml This example shows how to use the RepeatBehavior property to make a timeline repeat. --> <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowTitle="RepeatBehavior Example"> <Border HorizontalAlignment="Stretch"> <StackPanel Margin="20"> <!-- Create several rectangles to animate. --> <Rectangle Name="ForeverRepeatingRectangle" Fill="Orange" Width="50" Height="20" /> <Rectangle Name="FourSecondsRepeatingRectangle" Fill="Orange" Width="50" Height="20" /> <Rectangle Name="TwiceRepeatingRectangle" Fill="Orange" Width="50" Height="20" /> <Rectangle Name="HalfRepeatingRectangle" Fill="Orange" Width="50" Height="20" /> <Rectangle Name="OneSecondRepeatingRectangle" Fill="Orange" Width="50" Height="20" /> <!-- Create buttons to restart and stop the animations. --> <StackPanel Orientation="Horizontal" Margin="0,20,0,0"> <Button Name="restartButton">Start Animations</Button> <Button Name="stopButton" Background="#669900FF">Stop</Button> <StackPanel.Triggers> <EventTrigger SourceName="restartButton" RoutedEvent="Button.Click"> <BeginStoryboard Name="myBeginStoryboard"> <Storyboard> <!-- Create an animation that repeats indefinitely. --> <DoubleAnimation Storyboard.TargetName="ForeverRepeatingRectangle" Storyboard.TargetProperty="Width" From="50" To="300" Duration="0:0:2" RepeatBehavior="Forever" /> <!-- Create an animation that repeats for four seconds. As a result, the animation repeats twice. --> <DoubleAnimation Storyboard.TargetName="FourSecondsRepeatingRectangle" Storyboard.TargetProperty="Width" From="50" To="300" Duration="0:0:2" RepeatBehavior="0:0:4" /> <!-- Create an animation that repeats twice. --> <DoubleAnimation Storyboard.TargetName="TwiceRepeatingRectangle" Storyboard.TargetProperty="Width" From="50" To="300" Duration="0:0:2" RepeatBehavior="2x" /> <!-- Create an animation that repeats 0.5 times. The resulting animation plays for one second, half of its Duration. It animates from 50 to 150. --> <DoubleAnimation Storyboard.TargetName="HalfRepeatingRectangle" Storyboard.TargetProperty="Width" From="50" To="300" Duration="0:0:2" RepeatBehavior="0.5x" /> <!-- Create an animation that repeats for one second. The resulting animation plays for one second, half of its Duration. It animates from 50 to 150. --> <DoubleAnimation Storyboard.TargetName="OneSecondRepeatingRectangle" Storyboard.TargetProperty="Width" From="50" To="300" Duration="0:0:2" RepeatBehavior="0:0:1" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger SourceName="stopButton" RoutedEvent="Button.Click"> <StopStoryboard BeginStoryboardName="myBeginStoryboard" /> </EventTrigger> </StackPanel.Triggers> </StackPanel> </StackPanel> </Border> </Page>
For the complete sample, see Animation Timing Behavior Sample.
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.