TimelineMarkerCollection.Item property

Gets or sets the element at the specified index.

Syntax


public TimelineMarker this[int index] { get; set; }

Property value

Type: TimelineMarker

The element at the specified index.

Remarks

Collection API for TimelineMarkerCollection

A TimelineMarkerCollection is an ordered list where the order is determined by the Time value of each TimelineMarker item contained in the collection. The collection API for TimelineMarkerCollection internally processes each new item that is added to the collection and adds it at an index location that corresponds to an updated ordering of all Time values for all TimelineMarker items in the collection.

The intention of having the TimelineMarkerCollection always maintain a Time-based order is so that enumerating/iterating the collection gives the TimelineMarker values in the order that corresponds to the Position of a media asset that's being played and the order that MarkerReached events would fire. Otherwise, if the collection weren't Time-ordered, it would have been necessary to sort the collection by time prior to use.

  • If you use the Item indexer (or GetAt for C++) to read a value, the index is correct, based on how the item was added by the internal logic. But since you didn't directly control that logic, it's usually a better idea to use Contains (IndexOf for C++) to find a specific TimelineMarker in the ordered list.
  • If you use the Item indexer (or SetAt for C++) to set a value, you will delete a value that was previously at that index, but the collection will reorder itself to maintain the Time value ordering, so the new TimelineMarker you added might not be at the index you were setting to. This is probably a bad idea, because you won't be sure which item gets deleted. We recommend you don't use the indexer to set (change) values.

Requirements (Windows 10 device family)

Device family

API contract

Namespace

Windows.UI.Xaml.Media

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

See also

TimelineMarkerCollection

 

 

Vis: