Provides a base class that exposes the automation peer for an associated owner class to Microsoft UI Automation.
Inheritance
- Object
- DependencyObject
- AutomationPeer
Syntax
Attributes
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.UI.Xaml.Automation.Peers.IAutomationPeerStatics, NTDDI_WIN8)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
- WebHostHiddenAttribute()
Members
The AutomationPeer class has these types of members:
Constructors
The AutomationPeer class has these constructors.
| Constructor | Description |
|---|---|
| AutomationPeer | Provides base class initialization behavior for AutomationPeer derived classes. |
Methods
The AutomationPeer class has these methods. It also inherits methods from the Object class.
| Method | Description |
|---|---|
| ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject) |
| GetAcceleratorKey | Gets the accelerator key combinations for the object that is associated with the UI Automation peer. |
| GetAcceleratorKeyCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetAcceleratorKey or an equivalent Microsoft UI Automation client API. |
| GetAccessKey | Gets the access key for the element that is associated with the automation peer. |
| GetAccessKeyCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetAccessKey or an equivalent Microsoft UI Automation client API. |
| GetAnimationBaseValue | Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject) |
| GetAutomationControlType | Gets the control type for the element that is associated with the UI Automation peer. |
| GetAutomationControlTypeCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetAutomationControlType or an equivalent Microsoft UI Automation client API. |
| GetAutomationId | Gets the AutomationId of the element that is associated with the automation peer. |
| GetAutomationIdCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetAutomationId or an equivalent Microsoft UI Automation client API. |
| GetBoundingRectangle | Gets the Rect object that represents the screen coordinates of the element that is associated with the automation peer. |
| GetBoundingRectangleCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetBoundingRectangle or an equivalent Microsoft UI Automation client API. |
| GetChildren | Gets the collection of child elements that are represented in the UI Automation tree as immediate child elements of the automation peer. |
| GetChildrenCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetChildren or an equivalent Microsoft UI Automation client API. |
| GetClassName | Gets a name that is used with AutomationControlType, to differentiate the control that is represented by this AutomationPeer. |
| GetClassNameCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetClassName or an equivalent Microsoft UI Automation client API. |
| GetClickablePoint | Gets a point on the element that is associated with the automation peer that responds to a mouse click. |
| GetClickablePointCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetClickablePoint or an equivalent Microsoft UI Automation client API. |
| GetHelpText | Gets text that describes the functionality of the control that is associated with the automation peer. |
| GetHelpTextCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetHelpText or an equivalent Microsoft UI Automation client API. |
| GetItemStatus | Gets text that conveys the visual status of the element that is associated with this automation peer. |
| GetItemStatusCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetItemStatus or an equivalent Microsoft UI Automation client API. |
| GetItemType | Gets a string that describes what kind of item an element represents. |
| GetItemTypeCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetItemType or an equivalent Microsoft UI Automation client API. |
| GetLabeledBy | Gets the AutomationPeer for the UIElement that is targeted to the element. |
| GetLabeledByCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetLabeledBy or an equivalent Microsoft UI Automation client API. |
| GetLiveSetting | Gets the live setting notification behavior information for the object that is associated with the UI Automation peer. |
| GetLiveSettingCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetLiveSetting or an equivalent Microsoft UI Automation client API. |
| GetLocalizedControlType | Gets a localized string that represents the AutomationControlType value for the control that is associated with this automation peer. |
| GetLocalizedControlTypeCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetLocalizedControlType or an equivalent Microsoft UI Automation client API. |
| GetName | Gets text that describes the element that is associated with this automation peer. The Microsoft UI Automation Name value is the primary identifier used by most assistive technology when they represent your app's UI by interacting with the Microsoft UI Automation framework. |
| GetNameCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetName or an equivalent Microsoft UI Automation client API. |
| GetOrientation | Gets a value that indicates the explicit control orientation, if any. |
| GetOrientationCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetOrientation or an equivalent Microsoft UI Automation client API. |
| GetParent | Gets the AutomationPeer that is the parent of this AutomationPeer. |
| GetPattern | Gets the control pattern that is associated with the specified PatternInterface. |
| GetPatternCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetPattern or an equivalent Microsoft UI Automation client API. |
| GetPeerFromPoint | Gets an AutomationPeer from the specified point. |
| GetPeerFromPointCore | Provides the peer's behavior when a Microsoft UI Automation client calls GetPeerFromPoint or an equivalent Microsoft UI Automation client API. |
| GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject) |
| HasKeyboardFocus | Gets a value that indicates whether the element that is associated with this automation peer currently has keyboard focus. |
| HasKeyboardFocusCore | Provides the peer's behavior when a Microsoft UI Automation client calls HasKeyboardFocus or an equivalent Microsoft UI Automation client API. |
| InvalidatePeer | Triggers recalculation of the main properties of the AutomationPeer and raises the PropertyChanged notification to the automation client if the properties have changed. |
| IsContentElement | Gets a value that indicates whether the element that is associated with this automation peer contains data that is presented to the user. |
| IsContentElementCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsContentElement or an equivalent Microsoft UI Automation client API. |
| IsControlElement | Gets a value that indicates whether the element is understood by the user as interactive or as contributing to the logical structure of the control in the GUI. |
| IsControlElementCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsControlElement or an equivalent Microsoft UI Automation client API. |
| IsEnabled | Gets a value that indicates whether the element associated with this automation peer supports interaction. |
| IsEnabledCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsEnabled or an equivalent Microsoft UI Automation client API. |
| IsKeyboardFocusable | Gets a value that indicates whether the element can accept keyboard focus. |
| IsKeyboardFocusableCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsKeyboardFocusable or an equivalent Microsoft UI Automation client API. |
| IsOffscreen | Gets a value that indicates whether an element is off the screen. |
| IsOffscreenCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsOffscreen or an equivalent Microsoft UI Automation client API. |
| IsPassword | Gets a value that indicates whether the element contains sensitive content. |
| IsPasswordCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsPassword or an equivalent Microsoft UI Automation client API. |
| IsRequiredForForm | Gets a value that indicates whether the element that is associated with this peer must be completed on a form. |
| IsRequiredForFormCore | Provides the peer's behavior when a Microsoft UI Automation client calls IsRequiredForForm or an equivalent Microsoft UI Automation client API. |
| ListenerExists | Gets a value that indicates whether Microsoft UI Automation reports that a client is listening for the specified event. |
| PeerFromProvider | Gets an AutomationPeer for the specified IRawElementProviderSimple proxy. |
| ProviderFromPeer | Gets the IRawElementProviderSimple proxy for the specified AutomationPeer. |
| RaiseAutomationEvent | Raises an automation event. |
| RaisePropertyChangedEvent | Raises an event to notify the automation client of a changed property value. |
| ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject) |
| SetFocus | Sets the keyboard focus on the element that is associated with this automation peer. |
| SetFocusCore | Provides the peer's behavior when a Microsoft UI Automation client calls SetFocus or an equivalent Microsoft UI Automation client API. |
| SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject) |
Properties
The AutomationPeer class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | Gets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject) | |
| Read/write | Gets or sets an AutomationPeer that is reported to the automation client as the source for all the events that come from this AutomationPeer. See Remarks. |
Remarks
AutomationPeer is the class that provides almost all of the API that eventually forwards the UI Automation information for a Windows Store app built for Windows using C++, C#, or Visual Basic to a UI Automation client. Typical UI Automation clients aren't calling AutomationPeer methods directly. These clients are often assistive technologies that are using other programming models and operating as services, and are not likely to be calling Windows Runtime methods. But the general UI Automation support in the Windows Runtime forwards all this information as a provider such that any clients to UI Automation can interact with the representative automation trees of a Windows Store app using C++, C#, or Visual Basic.
Firing automation events
The AutomationPeer class is relevant to Windows Runtime control authors because you will have a peer instance available at run-time, after the runtime invokes the OnCreateAutomationPeer method. Using this peer, you can raise automation events by calling RaiseAutomationEvent and RaisePropertyChangedEvent. You would do this whenever a related property in the peer's owner (your class) changes, or when firing an event is needed for correct automation support.
The automation support design doesn't retain a handle to your own peer as part of how you implement OnCreateAutomationPeer, because there aren't any guarantees of when the peer is actually created. Instead, you can check for run-time automation event listeners inside your control class definitions just-in-time, using code like this:
if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged)) { MyAutomationPeer peer = FrameworkElementAutomationPeer.FromElement(myCtrl) as MyAutomationPeer; if (peer != null) { peer.RaisePropertyChangedEvent( RangeValuePatternIdentifiers.ValueProperty, (double)oldValue, (double)newValue); } }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012