MediaElement..::.MarkerReached Event Home
This page is specific to:Microsoft Version:Silverlight 3
.NET Framework Class Library for Silverlight
MediaElement..::.MarkerReached Event

Occurs when a timeline marker is encountered during media playback.

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

'Usage

Dim instance As MediaElement
Dim handler As TimelineMarkerRoutedEventHandler

AddHandler instance.MarkerReached, handler


'Declaration

Public Event MarkerReached As TimelineMarkerRoutedEventHandler
<MediaElement MarkerReached="eventhandler"/>
Remarks

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.

Examples

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.

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

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

Platforms

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

See Also

Reference

Community Content

Why the event isn't raised?
Added by:Thomas Lee

I used the MediaElement control in my project, and write code like the sample the same, but the MarkerReached event isn't raised, of couse I added the marker instnace. Anybody can tell me the reason? Thanks!

[tfl - 01 07 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at

http://www.microsoft.com/communities/newsgroups/en-us/ . You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C &
SQL Server :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C &
.NET Framework :
http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C &

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View