RateChangedRoutedEventHandler Delegate

Definition

Represents the method that will handle the RateChanged event. This event fires when PlaybackRate or DefaultPlaybackRate change either via user interaction or from code.

C#
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(149529175, 44549, 18587, 136, 57, 40, 198, 34, 93, 35, 73)]
public delegate void RateChangedRoutedEventHandler(object sender, RateChangedRoutedEventArgs e);

Parameters

sender
Object

The object where the handler is attached.

e
RateChangedRoutedEventArgs

The event data.

Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

This example uses C# code-behind to add a handler to a MediaElement named "myMediaElement" defined in XAML (not shown). The handler gets the PlaybackRate from the MediaElement. That information could be presented in UI as a number, or could be part of logic that displays different UI for normal playback or accelerated/slowed playback. Note that the current rate is obtainable from the MediaElement event source, it isn't carried in the event data.

Note

myMediaElement_RateChanged is raised when either the PlaybackRate or the DefaultPlaybackRate changes, so it is possible that myMediaElement.PlaybackRate queried below is unchanged from previous value.

C#
public MainPage()
        {
            this.InitializeComponent();
            myMediaElement.RateChanged += myMediaElement_RateChanged;
        }

        void myMediaElement_RateChanged(object sender, RateChangedRoutedEventArgs e)
        {
            Double CurrentPlayBackRate = myMediaElement.PlaybackRate;
        }

Applies to

Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100