UIElement.BeginAnimation Méthode

Définition

Lance une animation pour une propriété animée spécifiée sur cet élément.

Surcharges

BeginAnimation(DependencyProperty, AnimationTimeline)

Lance une animation pour une propriété animée spécifiée sur cet élément.

BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

Lance une animation spécifique pour une propriété animée spécifiée sur cet élément, avec l'option de la spécification de ce qui arrive si la propriété possède déjà une animation en cours d'exécution.

BeginAnimation(DependencyProperty, AnimationTimeline)

Lance une animation pour une propriété animée spécifiée sur cet élément.

public:
 virtual void BeginAnimation(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationTimeline ^ animation);
public void BeginAnimation (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationTimeline animation);
abstract member BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline -> unit
override this.BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline -> unit
Public Sub BeginAnimation (dp As DependencyProperty, animation As AnimationTimeline)

Paramètres

dp
DependencyProperty

Propriété permettant d'animer, spécifiée sous forme d'identificateur de propriété de dépendance.

animation
AnimationTimeline

Chronologie de l'animation à lancer.

Implémente

Exemples

L’exemple suivant crée une animation, l’affecte, puis appelle BeginAnimation pour la démarrer.

// Animate the button's width.
DoubleAnimation widthAnimation = 
    new DoubleAnimation(120, 300, TimeSpan.FromSeconds(5));
widthAnimation.RepeatBehavior = RepeatBehavior.Forever;
widthAnimation.AutoReverse = true;
animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation);
' Animate the button's width.
Dim widthAnimation As New DoubleAnimation(120, 300, TimeSpan.FromSeconds(5))
widthAnimation.RepeatBehavior = RepeatBehavior.Forever
widthAnimation.AutoReverse = True
animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation)

Remarques

Lorsque vous vérifiez si une propriété est animée, notez que l’animation commence et est considérée comme animée lorsque la première image au-delà du point de départ non animé est affichée.

Si la BeginTime valeur de animation est null, toutes les animations actuelles sont supprimées et la valeur actuelle de la propriété est conservée.

Si la valeur entière animation est null, toutes les animations sont supprimées de la propriété et la valeur de la propriété revient à sa valeur de base. Toutefois, la chronologie d’animation associée à l’origine n’est pas arrêtée. Toutes les autres animations affectées à cette chronologie continueront à s’exécuter.

S’applique à

BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

Lance une animation spécifique pour une propriété animée spécifiée sur cet élément, avec l'option de la spécification de ce qui arrive si la propriété possède déjà une animation en cours d'exécution.

public:
 virtual void BeginAnimation(System::Windows::DependencyProperty ^ dp, System::Windows::Media::Animation::AnimationTimeline ^ animation, System::Windows::Media::Animation::HandoffBehavior handoffBehavior);
public void BeginAnimation (System.Windows.DependencyProperty dp, System.Windows.Media.Animation.AnimationTimeline animation, System.Windows.Media.Animation.HandoffBehavior handoffBehavior);
abstract member BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline * System.Windows.Media.Animation.HandoffBehavior -> unit
override this.BeginAnimation : System.Windows.DependencyProperty * System.Windows.Media.Animation.AnimationTimeline * System.Windows.Media.Animation.HandoffBehavior -> unit
Public Sub BeginAnimation (dp As DependencyProperty, animation As AnimationTimeline, handoffBehavior As HandoffBehavior)

Paramètres

dp
DependencyProperty

Propriété permettant d'animer, spécifiée sous forme d'identificateur de propriété de dépendance.

animation
AnimationTimeline

Chronologie de l'animation à s'appliquer.

handoffBehavior
HandoffBehavior

Valeur quelconque de l'énumération qui spécifie comment la nouvelle animation interagit avec toute animation en cours affectant déjà la valeur de la propriété.

Implémente

Exemples

L’exemple suivant implémente un gestionnaire qui obtient une animation existante à partir d’une ressource, puis appelle BeginAnimation avec un comportement de transfert spécifié.

private void myFrameNavigated(object sender, NavigationEventArgs args)
{
    DoubleAnimation myFadeInAnimation = (DoubleAnimation)this.Resources["MyFadeInAnimationResource"];
    myFrame.BeginAnimation(Frame.OpacityProperty, myFadeInAnimation, HandoffBehavior.SnapshotAndReplace);
}
Private Sub myFrameNavigated(ByVal sender As Object, ByVal args As NavigationEventArgs)
    Dim myFadeInAnimation As DoubleAnimation = CType(Me.Resources("MyFadeInAnimationResource"), DoubleAnimation)
    myFrame.BeginAnimation(Frame.OpacityProperty, myFadeInAnimation, HandoffBehavior.SnapshotAndReplace)
End Sub

Remarques

Lorsque vous vérifiez si une propriété est animée, notez que l’animation commence et est considérée comme animée lorsque la première image au-delà du point de départ non animé est affichée.

Si la BeginTime valeur de animation est null, toutes les animations actuelles sont supprimées et la valeur actuelle de la propriété est conservée.

Si la valeur entière animation est null, toutes les animations sont supprimées de la propriété et la valeur de la propriété revient à sa valeur de base. Toutefois, la chronologie d’animation associée à l’origine n’est pas arrêtée. Toutes les autres animations affectées à cette chronologie continueront à s’exécuter.

S’applique à