MediaElementAutomationPeer MediaElementAutomationPeer MediaElementAutomationPeer MediaElementAutomationPeer Class


Exposes MediaElement types to Microsoft UI Automation.

public : class MediaElementAutomationPeer : FrameworkElementAutomationPeer, IMediaElementAutomationPeerpublic class MediaElementAutomationPeer : FrameworkElementAutomationPeer, IMediaElementAutomationPeerPublic Class MediaElementAutomationPeer Inherits FrameworkElementAutomationPeer Implements IMediaElementAutomationPeer// This API is not available in Javascript.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties


The Windows Runtime MediaElement class creates a new MediaElementAutomationPeer as its OnCreateAutomationPeer definition. Derive your automation peer from MediaElementAutomationPeer if you are deriving a custom class from MediaElement and want to add automation support for additional features that you enabled in your custom class. Then override OnCreateAutomationPeer so that it returns your custom peer.

Default peer implementation and overrides in MediaElementAutomationPeer

MediaElementAutomationPeer has overrides of Core methods such that the associated AutomationPeer methods provide peer-specific information to a Microsoft UI Automation client.

  • GetPattern reports no pattern support.
  • GetClassName returns "MediaElement".
  • GetAutomationControlType returns AutomationControlType.Custom.
  • GetChildren has a behavior that only works if isFullWindow on the owner is true. In this case it can return peers for child elements such as the transport controls. No patterns and a "Custom" control type don't provide much of an accessibility experience. This is by design for the basic MediaElement, because it really isn't a control. It's not focusable or invokable, and it doesn't have any kind of control surface such as elements that can be referenced to provide more automation information unless AreTransportControlsEnabled is true. Without transport controls, it's just a display surface for the media that takes up space in layout. Many apps would composite a MediaElement either within a control template or within an app definition where the MediaElement is included in a container along with a custom transport control surface. For example, you would typically have PlayPause and Stop buttons that hook up to the matching MediaElement methods that enable the user to control the actions of the media source. It's the control elements such as the buttons that need to have accessibility/automation support, so that the user can identify their actions and invoke them. Make sure that any control elements for a MediaElement report an automation Name, are focusable, and support at least one mode of invoking their action without using a pointer action.

Making the media content itself accessible requires planning, and is related to accessibility scenarios where Microsoft UI Automation isn't directly involved. For more info, see Making media content accessible.

The peer also has other behaviors that are provided by the base FrameworkElementAutomationPeer class. For more info, see "Base implementation in FrameworkElementAutomationPeer" section of Custom automation peers.


MediaElementAutomationPeer(MediaElement) MediaElementAutomationPeer(MediaElement) MediaElementAutomationPeer(MediaElement) MediaElementAutomationPeer(MediaElement)

Initializes a new instance of the MediaElementAutomationPeer class.

public : MediaElementAutomationPeer(MediaElement owner)public MediaElementAutomationPeer(MediaElement owner)Public Sub New(owner As MediaElement)// This API is not available in Javascript.
MediaElement MediaElement MediaElement MediaElement

The owner element to create for.

See Also