UIElement.GetAnimationBaseValue(DependencyProperty) 方法

定义

为此元素上的指定属性返回基属性值,忽略任何可能来自正在运行或已停止的动画的动画值。Returns the base property value for the specified property on this element, disregarding any possible animated value from a running or stopped animation.

public:
 virtual System::Object ^ GetAnimationBaseValue(System::Windows::DependencyProperty ^ dp);
public object GetAnimationBaseValue (System.Windows.DependencyProperty dp);
abstract member GetAnimationBaseValue : System.Windows.DependencyProperty -> obj
override this.GetAnimationBaseValue : System.Windows.DependencyProperty -> obj
Public Function GetAnimationBaseValue (dp As DependencyProperty) As Object

参数

dp
DependencyProperty

要检查的依赖项属性。The dependency property to check.

返回

就像没有动画被附加到指定的依赖属性一样的属性值。The property value as if no animations are attached to the specified dependency property.

实现

示例

下面的示例实现了一个处理程序,该处理程序报告 Button上动画 Width 属性的基值以及转换的基值。The following example implements a handler that reports the base value of an animated Width property on a Button, as well as the base value of a transform.

// 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));

}
' Display the base value for Button.Width and RotateTransform.Angle.
Private Sub animatedButton_Clicked(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim animatedButton As Button = CType(sender, Button)
    MessageBox.Show("Button width base value: " & animatedButton.GetAnimationBaseValue(Button.WidthProperty).ToString & vbLf & "RotateTransform base value: " & animatedRotateTransform.GetAnimationBaseValue(RotateTransform.AngleProperty).ToString)
End Sub

注解

如果没有任何动画附加到属性,则 GetAnimationBaseValue 返回值始终与 GetValue 返回值相同。If no animations are attached to the property, then the GetAnimationBaseValue return value is always identical to the GetValue return value. 如果附加了动画,则将忽略所有可能的动画派生值(包括开始值和结束值),并根据所有其他可能的输入来确定属性值。If there are animations attached, then all possible animation derived values including the start and stop values are ignored, and the property value is determined based on all other possible inputs. 有关详细信息,请参阅依赖属性值优先级For more information, see Dependency Property Value Precedence.

适用于

另请参阅