AnimatedIcon.Source Eigenschaft

Definition

Dient zum Abrufen oder Festlegen des animierten visuellen Objekts AnimatedIcon .

Diese Dokumentation gilt für WinUI 2 für UWP (für WinUI im Windows App SDK, siehe Windows App SDK Namespaces).

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; }
Public Property Source As IAnimatedVisualSource2

Eigenschaftswert

Das animierte Visuelle, das von der AnimatedIcon. Der Standardwert ist null.

Attribute
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute

Beispiele

In diesem Beispiel wird die AnimatedIcon.Source Eigenschaft auf AnimatedBackVisualSource festgelegt.

<!-- 
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
-->

<muxc:AnimatedIcon>
    <animatedvisuals:AnimatedBackVisualSource/>
</muxc:AnimatedIcon>

Hinweise

Die Source Eigenschaft unterstützt keine XAML-Attributsyntax (<AnimatedIcon Source="..."/>); Sie müssen die Eigenschaft mithilfe der SourceXAML-Eigenschaftselementsyntax festlegen. Source Ist jedoch als Inhaltseigenschaft des Steuerelements definiert, sodass Sie die expliziten <AnimatedIcon.Source> Tags weglassen können. Diese XAML-Deklarationen erzeugen dasselbe Ergebnis.

<!--  These XAML declarations produce the same result. -->

<muxc:AnimatedIcon>
    <muxc:AnimatedIcon.Source>
        <animatedvisuals:AnimatedBackVisualSource/>
    </muxc:AnimatedIcon.Source>
</muxc:AnimatedIcon>

<muxc:AnimatedIcon>
    <animatedvisuals:AnimatedBackVisualSource/>
</muxc:AnimatedIcon>

WinUI stellt animierte visuelle Elemente für einige gängige Symbole im Microsoft.UI.Xaml.Controls.AnimatedVisuals-Namespace bereit.

Sie können benutzerdefinierte Animationen erstellen, die als animiertes Symbol in Ihrer App verwendet werden sollen. Animationen können mit Adobe AfterEffects erstellt werden, und Sie können diese Ausgabe mit der Lottie-Windows-Bibliothek verwenden, um eine benutzerdefinierte Klasse zu generieren, die IAnimatedVisualSource2 implementiert. Sie können diese Klasse als Quelle für ein animiertes Symbol verwenden. Weitere Informationen finden Sie unter Verwenden von Lottie zum Erstellen animierter Inhalte für ein AnimationIcon.

Gilt für:

Weitere Informationen