Windows Dev Center

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.

Syntax


public delegate void RateChangedRoutedEventHandler(
  object sender, 
  RateChangedRoutedEventArgs e
)

Parameters

sender

Type: System.Object [.NET] | Platform::Object [C++]

The object where the handler is attached.

e

Type: RateChangedRoutedEventArgs

The event data.

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;
        }


Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Media
Windows::UI::Xaml::Media [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Media
Windows::UI::Xaml::Media [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]
[WebHostHidden()]

 

 

Show:
© 2015 Microsoft