Gets the collection of timeline markers associated with the currently loaded media file.

value = object.Markers

Property Value

Type: TimelineMarkerCollection

The collection of timeline markers (represented as TimelineMarker objects) that are associated with the currently loaded media file.

This property is read-only. The default value is an empty collection.

Managed Equivalent



This collection is cleared and repopulated each time this MediaElement opens a new source file, and is only considered valid after the MediaOpened event has occurred.

Although the MediaElement object supports all Windows media technology markers (markers, metadata script commands, and separate-stream script commands), this collection does not include any timeline markers encoded as a separate stream in the media file, such as separate-stream script commands. If a file contains both header-embedded script commands and separate-stream script commands, this collection contains only those embedded in the file header. This is because MediaOpened is raised after reading the headers and metadata, but the full source might still be buffering, and, therefore, any separate stream markers will not be available yet. Separate-stream script commands do raise the MarkerReached event when encountered during media playback. However, these markers are not accessible ahead of time through the Markers property.

You can create strings for TimelineMarker elements that you create through CreateFromXaml, and then add them to a media file. However, you cannot access the Markers property through XAML or specify an initial set of markers in XAML. This is because the collection only comes from a populated Source and is, therefore, not tied to the XAML. If you want to prepopulate markers, you should embed them in the media instead.

Applies To


See Also