UIElement.BeginAnimation Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Démarre une animation pour une propriété animée spécifiée sur cet élément.
Surcharges
| Nom | Description |
|---|---|
| BeginAnimation(DependencyProperty, AnimationTimeline) |
Démarre une animation pour une propriété animée spécifiée sur cet élément. |
| BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior) |
Démarre une animation spécifique pour une propriété animée spécifiée sur cet élément, avec la possibilité de spécifier ce qui se passe si la propriété a déjà une animation en cours d’exécution. |
BeginAnimation(DependencyProperty, AnimationTimeline)
Démarre 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
Propriété à animer, qui est spécifiée en tant qu’identificateur de propriété de dépendance.
- animation
- AnimationTimeline
Chronologie de l’animation à démarrer.
Implémente
Exemples
L’exemple suivant crée une animation, l’affecte, puis appelle BeginAnimation pour le 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 sera considérée comme animée lorsque la première image au-delà du point de départ non animé est rendue.
Si la BeginTimeanimationnullvaleur est définie, 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)
Démarre une animation spécifique pour une propriété animée spécifiée sur cet élément, avec la possibilité de spécifier ce qui se passe si la propriété a 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
Propriété à animer, qui est spécifiée comme identificateur de propriété de dépendance.
- animation
- AnimationTimeline
Chronologie de l’animation à appliquer.
- handoffBehavior
- HandoffBehavior
Valeur de l’énumération qui spécifie comment la nouvelle animation interagit avec toutes les animations actuelles (en cours d’exécution) qui affectent déjà la valeur de 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 sera considérée comme animée lorsque la première image au-delà du point de départ non animé est rendue.
Si la BeginTimeanimationnullvaleur est définie, 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.