Animatable.GetAnimationBaseValue Method

Returns the non-animated value of the specified DependencyProperty.

Namespace:  System.Windows.Media.Animation
Assembly:  PresentationCore (in PresentationCore.dll)

'Declaration
Public Function GetAnimationBaseValue ( _
	dp As DependencyProperty _
) As Object

Parameters

dp
Type: System.Windows.DependencyProperty
Identifies the property whose base (non-animated) value should be retrieved.

Return Value

Type: System.Object
The value that would be returned if the specified property were not animated.

Implements

IAnimatable.GetAnimationBaseValue(DependencyProperty)

If the specified property is not animated, this method returns the same result as GetValue.

In the following example, the non-animated values of animated properties are retrieved and displayed.


'
'
'   This sample shows how to use the 
'   Animatable.GetAnimationBaseValue and 
'   UIElement.GetAnimationBaseValue methods
'   to get the non-animated value of an
'   animated Animatable or UIElement.
'
'

Imports System
Imports System.Windows
Imports System.Windows.Navigation
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports System.Windows.Controls
Imports System.Windows.Input
Imports Microsoft.VisualBasic

Namespace Microsoft.Samples.Animation.TimingBehaviors


	Public Class GetAnimationBaseValueExample
		Inherits Page


		Private animatedRotateTransform As RotateTransform
		Public Sub New()

			WindowTitle = "GetAnimationBaseValue Example"
			Dim myPanel As New StackPanel()
			myPanel.Margin = New Thickness(20.0)

			' Create a button.
			Dim animatedButton As New Button()
			animatedButton.Content = "Click Me"
			animatedButton.Width = 100
			animatedButton.Margin = New Thickness(100)

			' Create and animate a RotateTransform and
			' apply it to the button's RenderTransform
			' property.
			animatedRotateTransform = New RotateTransform()
			animatedRotateTransform.Angle = 45
			Dim angleAnimation As New DoubleAnimation(0,360, TimeSpan.FromSeconds(5))
			angleAnimation.RepeatBehavior = RepeatBehavior.Forever
			animatedRotateTransform.BeginAnimation(RotateTransform.AngleProperty, angleAnimation)
			animatedButton.RenderTransform = animatedRotateTransform
			animatedButton.RenderTransformOrigin = New Point(0.5,0.5)
			' Animate the button's width.
			Dim widthAnimation As New DoubleAnimation(120, 300, TimeSpan.FromSeconds(5))
			widthAnimation.RepeatBehavior = RepeatBehavior.Forever
			widthAnimation.AutoReverse = True
			animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation)

			' Handle button clicks.
			AddHandler animatedButton.Click, AddressOf animatedButton_Clicked

			' Add the button to the panel.
			myPanel.Children.Add(animatedButton)
			Me.Content = myPanel
		End Sub

		' 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

	End Class

End Namespace


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft