Partager via


MediaElement.CanPause Property

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

Gets a value indicating if media can be paused if the Pause method is called.

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

Syntax

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

Property Value

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

Remarks

Dependency property identifier field: CanPauseProperty

Streaming media cannot be paused. Therefore CanPause returns false for any case where the MediaElement has loaded streaming media. However, it should not be inferred that any case where CanPause 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.

Calling Pause 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 "Pause" button that appears in UI if CanPause 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.