UIElement.GetAnimationBaseValue(DependencyProperty) 方法

定義

傳回這個項目上指定屬性的基底屬性值,不管任何執行中的可能動畫值,或停止動畫。

C#
public object GetAnimationBaseValue(System.Windows.DependencyProperty dp);

參數

dp
DependencyProperty

要檢查的相依性屬性。

傳回

屬性值,就好像指定的相依性屬性未附加任何動畫。

實作

範例

下列範例會實作處理常式,以報告 上 Button 動畫 Width 屬性的基底值,以及轉換的基底值。

C#
// Display the base value for Button.Width and RotateTransform.Angle.
private void animatedButton_Clicked(object sender, RoutedEventArgs e)
{
    Button animatedButton = (Button)sender;
    MessageBox.Show("Button width base value: " + 
        animatedButton.GetAnimationBaseValue(Button.WidthProperty)
        + "\nRotateTransform base value: " +
        animatedRotateTransform.GetAnimationBaseValue(RotateTransform.AngleProperty));
}

備註

如果未附加任何動畫至 屬性,則傳 GetAnimationBaseValue 回值一律與 GetValue 傳回值相同。 如果有附加動畫,則會忽略所有可能的動畫衍生值,包括開始和停止值,而且屬性值會根據所有其他可能的輸入來決定。 如需詳細資訊,請參閱相依性屬性值優先順序

適用於

產品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另請參閱