AnimatedIcon.Source Propriété
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.
Obtient ou définit le visuel animé affiché par l’objet AnimatedIcon
.
public:
property IAnimatedVisualSource2 ^ Source { IAnimatedVisualSource2 ^ get(); void set(IAnimatedVisualSource2 ^ value); };
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
IAnimatedVisualSource2 Source();
void Source(IAnimatedVisualSource2 value);
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
IAnimatedVisualSource2 Source();
void Source(IAnimatedVisualSource2 value);
public IAnimatedVisualSource2 Source { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] set; }
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
public IAnimatedVisualSource2 Source { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] set; }
var iAnimatedVisualSource2 = animatedIcon.source;
animatedIcon.source = iAnimatedVisualSource2;
Public Property Source As IAnimatedVisualSource2
Valeur de propriété
Visuel animé présenté par .AnimatedIcon
Par défaut, il s’agit de null
.
- Attributs
-
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute
Exemples
Cet exemple montre comment définir la AnimatedIcon.Source
propriété sur AnimatedBackVisualSource.
<!--
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
-->
<AnimatedIcon>
<animatedvisuals:AnimatedBackVisualSource/>
</AnimatedIcon>
Remarques
La Source
propriété ne prend pas en charge la syntaxe d’attribut XAML (<AnimatedIcon Source="..."/>
). Vous devez définir le à l’aide de la syntaxe de l’élément Source
de propriété XAML. Toutefois, Source
étant défini comme propriété de contenu du contrôle, vous pouvez omettre les balises explicites <AnimatedIcon.Source>
. Ces déclarations XAML produisent le même résultat.
<!-- These XAML declarations produce the same result. -->
<AnimatedIcon>
<AnimatedIcon.Source>
<animatedvisuals:AnimatedBackVisualSource/>
</AnimatedIcon.Source>
</AnimatedIcon>
<AnimatedIcon>
<animatedvisuals:AnimatedBackVisualSource/>
</AnimatedIcon>
WinUI fournit des visuels animés pour certaines icônes courantes dans l’espace de noms Microsoft.UI.Xaml.Controls.AnimatedVisuals .
Vous pouvez créer des animations personnalisées à utiliser comme icône animée dans votre application. Les animations peuvent être créées avec Adobe AfterEffects, puis vous pouvez utiliser cette sortie avec la bibliothèque Lottie-Windows pour générer une classe personnalisée qui implémente IAnimatedVisualSource2. Vous pouvez utiliser cette classe comme source pour une icône animée. Pour plus d’informations, consultez Utiliser Lottie pour créer du contenu animé pour une AnimationIcon.