コード例 #1
0
        //<SnippetGetAnimationBaseValue>
        // 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));
        }
コード例 #2
0
        private void BtnAnimation_Click(object sender, RoutedEventArgs e)
        {
            RotateTransform animatedRotateTransform = new RotateTransform();

            animatedRotateTransform.Angle = 45;
            DoubleAnimation angleAnimation =
                new DoubleAnimation(0, 360, TimeSpan.FromSeconds(5));

            angleAnimation.RepeatBehavior = RepeatBehavior.Forever;
            animatedRotateTransform.BeginAnimation(
                RotateTransform.AngleProperty, angleAnimation);
            animatedRotateTransform.GetAnimationBaseValue(RotateTransform.AngleProperty);
        }