MediaElementAutomationPeer MediaElementAutomationPeer MediaElementAutomationPeer Class
public : class MediaElementAutomationPeer : FrameworkElementAutomationPeer, IMediaElementAutomationPeer
public class MediaElementAutomationPeer : FrameworkElementAutomationPeer, IMediaElementAutomationPeer
Public Class MediaElementAutomationPeer Inherits FrameworkElementAutomationPeer Implements IMediaElementAutomationPeer
Windows 10 (introduced v10.0.10240.0)
Windows.Foundation.UniversalApiContract (introduced v1)
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
- 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)
Initializes a new instance of the MediaElementAutomationPeer class.
public : MediaElementAutomationPeer(MediaElement owner)
public MediaElementAutomationPeer(MediaElement owner)
Public Sub New(owner As MediaElement)