Diese Dokumentation wurde archiviert und wird nicht länger gepflegt.


Occurs when the rate at which time progresses for the timeline's clock changes.

Namespace: System.Windows.Media.Animation
Assembly: PresentationCore (in presentationcore.dll)
XML-Namespaces:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public event EventHandler CurrentGlobalSpeedInvalidated
/** @event */
public void add_CurrentGlobalSpeedInvalidated (EventHandler value)

/** @event */
public void remove_CurrentGlobalSpeedInvalidated (EventHandler value)

In JScript können Sie die durch eine Klasse definierten Ereignisse verwenden, jedoch keine eigenen definieren.
<object CurrentGlobalSpeedInvalidated="EventHandler" .../>

The current global speed of a timeline's clock changes in the following circumstances:

  • The clock changes direction because of its timeline's AutoReverse setting.

  • The clock accelerates or decelerates because of its timeline's AccelerationRatio or DecelerationRatio property settings.

  • The clock is paused or resumed.

  • The clock becomes inactive or reactivates.

  • The CurrentGlobalSpeed of one of the clock's parent changes.

The CurrentGlobalSpeedInvalidated event is useful for tracking when a timeline's clock becomes paused; in your event handler, use your storyboard's GetCurrentGlobalSpeed method or check the clock's IsPaused property to determine whether its clock is paused; compare this against a previously cached value to determine whether it changed.

The Object parameter of the EventHandler event handler is the timeline's Clock.

Although this event handler appears to be associated with a timeline, it actually registers with the Clock created for this timeline. For more information, see the Timing Events Overview.

The following example shows how to register for the CurrentGlobalSpeedInvalidated event.


   This example shows how to register for the
   CurrentGlobalSpeedInvalidated event
   using a Timeline. 


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 TimelineCurrentGlobalSpeedInvalidatedExample : Page {

        private TextBlock currentTimeTextBlock;
        public TimelineCurrentGlobalSpeedInvalidatedExample()
            // Create a name scope.
            NameScope.SetNameScope(this, new NameScope());
            WindowTitle = "GetAnimationBaseValue Example";
            StackPanel myPanel = new StackPanel();
            myPanel.Margin = new Thickness(20);     
            // Create a rectangle.
            Rectangle animatedRectangle = new Rectangle();
            animatedRectangle.Width = 100;
            animatedRectangle.Height = 50;
            animatedRectangle.Margin = new Thickness(50);
            animatedRectangle.Fill = Brushes.Orange;
            animatedRectangle.Stroke = Brushes.Gray;
            animatedRectangle.StrokeThickness = 2;
            // Create a RotateTransform.
            RotateTransform animatedTransform = new RotateTransform();
            animatedTransform.Angle = 0;
            this.RegisterName("animatedTransform", animatedTransform);
            animatedRectangle.RenderTransform = animatedTransform;
            animatedRectangle.RenderTransformOrigin = new Point(0.5,0.5);
            this.Content = myPanel;

            // Create a TextBlock to show the storyboard's current time.
            currentTimeTextBlock = new TextBlock();
            // Animate the RotateTransform's angle using a Storyboard.
            DoubleAnimation angleAnimation = new DoubleAnimation(0,360, TimeSpan.FromSeconds(5));
            angleAnimation.RepeatBehavior = RepeatBehavior.Forever;
            angleAnimation.AutoReverse = true;
            Storyboard.SetTargetName(angleAnimation, "animatedTransform");
                new PropertyPath(RotateTransform.AngleProperty));
            Storyboard theStoryboard = new Storyboard();
            // Register the CurrentGlobalSpeedInvalidated event.
            // You must register for events before you begin 
            // the storyboard.
            angleAnimation.CurrentGlobalSpeedInvalidated += 
                new EventHandler(angleAnimation_CurrentGlobalSpeedInvalidated);
            // Start the storyboard.
            theStoryboard.Begin(animatedRectangle, true);
        private void angleAnimation_CurrentGlobalSpeedInvalidated(object sender, EventArgs e)
            // Sender is the clock that was created for the DoubleAnimation.
            Clock doubleAnimationClock = (Clock)sender;
            // Update the TextBlock with the time of its parent.
            currentTimeTextBlock.Text = doubleAnimationClock.Parent.CurrentTime.ToString();       


Microsoft .NET Framework 3.0 wird unter Windows Vista, Microsoft Windows XP SP2 und Windows Server 2003 SP1 unterstützt.

.NET Framework

Unterstützt in: 3.0