Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Animatable.GetAnimationBaseValue Method (DependencyProperty)

 

Returns the non-animated value of the specified DependencyProperty.

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

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.

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
Available since 3.0
Return to top
Show:
© 2017 Microsoft