MediaElementAutomationPeer class
Collapse the table of content
Expand the table of content

MediaElementAutomationPeer class

Exposes MediaElement types to Microsoft UI Automation.




public class MediaElementAutomationPeer : FrameworkElementAutomationPeer


The MediaElementAutomationPeer class has these types of members:


The MediaElementAutomationPeer class has these constructors.

MediaElementAutomationPeer Initializes a new instance of the MediaElementAutomationPeer class.



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 UI Automation client.

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 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.

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::Automation::Peers [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml::Automation::Peers [C++]





See also

Custom automation peers
Making media content accessible



© 2016 Microsoft