Markers Property

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

See Remarks.
value = object.markers

Property Value


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

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


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 only contains 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 thus any separate stream markers are not available yet. Separate-stream script commands do trigger the MarkerReached event when encountered during media playback. However these markers are not accessible ahead of time using the Markers property.

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

Applies To


See Also

Media Overview