Expand Minimize

MediaElement.Position property

Gets or sets the current position of progress through the media's playback time.


Public Property Position As TimeSpan

Property value

Type: System.TimeSpan [.NET] | Windows::Foundation::TimeSpan [C++]

The amount of time since the beginning of the media. The default is a TimeSpan with value "0:0:0".


Set this property to set a specific start-play position within the media.

A TimeSpan is represented as different types depending on the programming language you are using.

C# or Visual Basic:  Use a System.TimeSpan structure. System.TimeSpan has utility members such as Parse(String) that make it easy to create, change or compare time values.

C++/CX:  Use a Windows::Foundation::TimeSpan structure. This structure has only one field member (Duration), which measures by 100-nanosecond units. If you intend to display a Position value in an hours:minutes:seconds format, you'll have to write your own logic for converting to that format from the Duration units.

If you are not sure of the current media source loaded as MediaElement.Source, always check CanSeek first. A streaming media source results in the MediaElement reporting CanSeek as false, and in this case you cannot use Position to set the playback point.

If Position is settable, then these value constraints apply:

  • If Position is set to a negative value, the value will revert to a TimeSpan with value "0:0:0".
  • If Position is set to a value larger than the media's NaturalDuration, then Position becomes the value of NaturalDuration.

Notes on XAML syntax

Setting a Position value in XAML is technically possible but not common. If you do set a Position in XAML, simulate the "FromString" type conversion behavior for a TimeSpan, in other words specify the value in the form "HH:MM:SS".

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml::Controls [C++]



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]


Windows::UI::Xaml::Controls [C++]



See also




© 2015 Microsoft