Partager via


MediaElement.CanSeek Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets a value indicating if media can be repositioned by setting the value of the Position property.

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

Syntax

'Declaration
Public ReadOnly Property CanSeek As Boolean
public bool CanSeek { get; }

Property Value

Type: System.Boolean
true if the media can be repositioned; otherwise, false.
The default value is false.

Remarks

Dependency property identifier field: CanSeekProperty

Live streaming media cannot be paused. Therefore CanSeek returns false for any case where the MediaElement has loaded live streaming media. However, it should not be inferred that any case where CanSeek is false always indicates streaming media. This API is intended for determining whether user capabilities are available at a point in time so that your application can present appropriate UI, and is not intended for probing the media itself.

Setting Position on a MediaElement that has opened and is playing streaming content does not throw an error. Instead the method call is ignored.

One scenario for this property is to check it after MediaOpened is raised, and potentially change the display characteristics of any "Scrub" control appears in UI if CanSeek is false.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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