AnimatedIcon.Source 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 對象所 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
屬性值
所 AnimatedIcon
顯示的動畫視覺效果。 預設值為 null
。
- 屬性
-
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute
範例
本範例會將 AnimatedIcon.Source
屬性設定為 AnimatedBackVisualSource。
<!--
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
-->
<AnimatedIcon>
<animatedvisuals:AnimatedBackVisualSource/>
</AnimatedIcon>
備註
屬性Source
不支援 xaml 屬性語法 () <AnimatedIcon Source="..."/>
;您必須使用 XAML 屬性元素語法來設定 Source
。 不過, Source
定義為控件 的內容屬性,因此您可以省略明確的 <AnimatedIcon.Source>
標記。 這些 XAML 宣告會產生相同的結果。
<!-- These XAML declarations produce the same result. -->
<AnimatedIcon>
<AnimatedIcon.Source>
<animatedvisuals:AnimatedBackVisualSource/>
</AnimatedIcon.Source>
</AnimatedIcon>
<AnimatedIcon>
<animatedvisuals:AnimatedBackVisualSource/>
</AnimatedIcon>
WinUI 為 Microsoft.UI.Xaml.Controls.AnimatedVisuals 命名空間中的一些常見圖示提供動畫視覺效果。
您可以建立自定義動畫,以作為應用程式中的動畫圖示。 您可以使用 Adobe AfterEffects 建立動畫,然後使用該輸出搭配 Lottie-Windows 連結庫來產生實作 IAnimatedVisualSource2 的自定義類別。 您可以使用這個類別作為動畫圖示 的來源 。 如需詳細資訊,請參閱 使用Lottie建立AnimatedIcon的動畫內容。