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

RadialGradientBrush.RadiusYProperty, champ

Identifie la propriété de dépendance RadiusY.

Espace de noms :  System.Windows.Media
Assembly :  PresentationCore (dans PresentationCore.dll)
public static readonly DependencyProperty RadiusYProperty

Valeur de champ

Type : System.Windows.DependencyProperty
Identificateur de la propriété de dépendance RadiusY.

Cet exemple montre une façon d'appliquer une animation à une propriété sans utiliser de Storyboard.

RemarqueRemarque

Ces fonctionnalités ne sont pas disponibles en XAML (eXtensible Application Markup Language). Pour plus d'informations sur l'animation d'une propriété en XAML, consultez Comment : animer une propriété à l'aide d'un storyboard.

Pour appliquer une animation locale à une propriété, utilisez la méthode BeginAnimation. Cette méthode accepte deux paramètres : un DependencyProperty qui spécifie la propriété à animer, et l'animation à appliquer à cette propriété.

L'exemple suivant montre comment animer la largeur et la couleur d'arrière-plan d'un Button.


/*

   This sample demonstrates how to apply non-storyboard animations to a property.
   To animate in markup, you must use storyboards.

*/

using System;
using System.Windows;
using System.Windows.Navigation;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Controls;

namespace Microsoft.Samples.Animation.LocalAnimations
{

    // Create the demonstration.
    public class LocalAnimationExample : Page 
    {




        public LocalAnimationExample()
        {


            WindowTitle = "Local Animation Example";
            StackPanel myStackPanel = new StackPanel();
            myStackPanel.Margin = new Thickness(20);                     


            // Create and set the Button.
            Button aButton = new Button();
            aButton.Content = "A Button";

            // Animate the Button's Width.
            DoubleAnimation myDoubleAnimation = new DoubleAnimation();
            myDoubleAnimation.From = 75;
            myDoubleAnimation.To = 300;
            myDoubleAnimation.Duration =  new Duration(TimeSpan.FromSeconds(5));
            myDoubleAnimation.AutoReverse = true;
            myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

            // Apply the animation to the button's Width property.
            aButton.BeginAnimation(Button.WidthProperty, myDoubleAnimation);       

            // Create and animate a Brush to set the button's Background.
            SolidColorBrush myBrush = new SolidColorBrush();
            myBrush.Color = Colors.Blue;            

            ColorAnimation myColorAnimation = new ColorAnimation();
            myColorAnimation.From = Colors.Blue;
            myColorAnimation.To = Colors.Red;
            myColorAnimation.Duration =  new Duration(TimeSpan.FromMilliseconds(7000));
            myColorAnimation.AutoReverse = true;
            myColorAnimation.RepeatBehavior = RepeatBehavior.Forever;

            // Apply the animation to the brush's Color property.
            myBrush.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation);           
            aButton.Background = myBrush;

            // Add the Button to the panel.
            myStackPanel.Children.Add(aButton);
            this.Content = myStackPanel;
        }
    }

}


Il existe diverses classes d'animation dans l'espace de noms System.Windows.Media.Animation pour animer différents types de propriétés. Pour plus d'informations sur l'animation des propriétés, consultez Vue d'ensemble de l'animation. Pour plus d'informations sur les propriétés de dépendance (le type de propriétés présentées dans ces exemples) et leurs fonctionnalités, consultez Vue d'ensemble des propriétés de dépendance.

Il existe d'autres façons d'animer sans utiliser d'objets Storyboard ; pour plus d'informations, consultez Vue d'ensemble des techniques d'animation de propriétés.

.NET Framework

Pris en charge dans : 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Pris en charge dans : 4, 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (rôle principal du serveur non pris en charge), Windows Server 2008 R2 (rôle principal du serveur pris en charge avec SP1 ou version ultérieure ; Itanium non pris en charge)

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)

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.