Animatable.GetAnimationBaseValue(DependencyProperty) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 DependencyProperty의 애니메이션이 적용되지 않은 값을 반환합니다.
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
매개 변수
애니메이션이 적용되지 않은 기준 값을 검색하는 속성을 식별합니다.
반환
지정된 속성에 애니메이션이 적용되지 않은 경우 반환되는 값입니다.
구현
예제
다음 예제에서는 애니메이션된 속성의 애니메이션이 적용 되지 않은 값을 검색 및 표시 됩니다.
/*
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.
*/
using System;
using System.Windows;
using System.Windows.Navigation;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Controls;
using System.Windows.Input;
namespace Microsoft.Samples.Animation.TimingBehaviors
{
public class GetAnimationBaseValueExample : Page {
private RotateTransform animatedRotateTransform;
public GetAnimationBaseValueExample()
{
WindowTitle = "GetAnimationBaseValue Example";
StackPanel myPanel = new StackPanel();
myPanel.Margin = new Thickness(20.0);
// Create a button.
Button animatedButton = 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;
DoubleAnimation angleAnimation =
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.
DoubleAnimation widthAnimation =
new DoubleAnimation(120, 300, TimeSpan.FromSeconds(5));
widthAnimation.RepeatBehavior = RepeatBehavior.Forever;
widthAnimation.AutoReverse = true;
animatedButton.BeginAnimation(Button.WidthProperty, widthAnimation);
// Handle button clicks.
animatedButton.Click += new RoutedEventHandler(animatedButton_Clicked);
// Add the button to the panel.
myPanel.Children.Add(animatedButton);
this.Content = myPanel;
}
// 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));
}
}
}
'
'
' 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.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
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
설명
이 메서드가 반환으로 동일한 결과 지정된 된 속성 움직이지 않으면 GetValue합니다.