RateChangedRoutedEventHandler RateChangedRoutedEventHandler RateChangedRoutedEventHandler RateChangedRoutedEventHandler Delegate


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

public : delegate void RateChangedRoutedEventHandler(Platform::Object sender, RateChangedRoutedEventArgs e)
struct RateChangedRoutedEventHandler : winrt::Windows::Foundation::IUnknown
   RateChangedRoutedEventHandler(std::nullptr_t = nullptr) noexcept;
   template <typename L> RateChangedRoutedEventHandler(L lambda);
   template <typename F> RateChangedRoutedEventHandler(F* function);
   template <typename O, typename M> RateChangedRoutedEventHandler(O* object, M method);
   void operator()(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Media::RateChangedRoutedEventArgs const& e) const;
public delegate void RateChangedRoutedEventHandler(Object sender, RateChangedRoutedEventArgs e)
Public Delegate Sub RateChangedRoutedEventHandler(sender As Object, e As RateChangedRoutedEventArgs)


Object Object

The object where the handler is attached.


Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


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.


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()
            myMediaElement.RateChanged += myMediaElement_RateChanged;

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