Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MediaElement.MarkerReached Event


Occurs when a timeline marker is encountered during media playback.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public event TimelineMarkerRoutedEventHandler MarkerReached
<MediaElement MarkerReached="eventhandler"/>

The MarkerReached event is not raised when the MediaElement seeks past a timeline marker. This event is raised whenever a marker associated with the media is reached. The marker might come from one of three locations:

  • Stored in the metadata of the currently opened media.

  • Associated with the currently opened media and coming from a separate stream.

  • Explicitly added to the Markers collection for the currently opened media, using script.

The following example creates a MediaElement object and responds to its MarkerReached event. Each time a timeline marker is reached, the example displays the timeline marker's Time, Type, and Text values.

            <TextBlock x:Name="timeTextBlock" FontSize="12">Time:</TextBlock>
            <TextBlock x:Name="typeTextBlock" FontSize="12">Type:</TextBlock>
            <TextBlock x:Name="valueTextBlock" FontSize="12">Value:</TextBlock>
              <MediaElement x:Name="media" Width="300" Height="200" 
               MarkerReached="OnMarkerReached" Source="thebutterflyandthebear.wmv"/>

        public void OnMarkerReached(object sender, TimelineMarkerRoutedEventArgs e)

            timeTextBlock.Text = e.Marker.Time.Seconds.ToString();
            typeTextBlock.Text = e.Marker.Type.ToString();
            valueTextBlock.Text = e.Marker.Text;


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

© 2016 Microsoft