Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 2.11 KB

ratechangedroutedeventhandler.md

File metadata and controls

46 lines (32 loc) · 2.11 KB
-api-id -api-type
T:Windows.UI.Xaml.Media.RateChangedRoutedEventHandler
winrt delegate

Windows.UI.Xaml.Media.RateChangedRoutedEventHandler

-description

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

-parameters

-param sender

The object where the handler is attached.

-param e

The event data.

-remarks

-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.

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

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

-see-also