AutomationPeer Class
Definition
Provides a base class that exposes an element to UI Automation.
public class AutomationPeer
Methods
| Name | Description |
|---|---|
| BringIntoView | Attempts to bring the element associated with the automation peer into view. |
| GetAcceleratorKey | Gets the accelerator key combinations for the element that is associated with the UI Automation peer. |
| GetAccessKey | Gets the access key for the element that is associated with the automation peer. |
| GetAutomationControlType | Gets the control type for the element that is associated with the UI Automation peer. |
| GetAutomationId | Gets the automation ID of the element that is associated with the UI Automation peer. |
| GetBoundingRectangle | Gets the bounding rectangle of the element that is associated with the automation peer in top-level coordinates. |
| GetChildren | Gets the child automation peers. |
| GetClassName | Gets a string that describes the class of the element. |
| GetHeadingLevel | Gets the heading level that is associated with this automation peer. |
| GetHelpText | Gets text that provides help for the element that is associated with this automation peer. |
| GetItemStatus | Gets the item status that is associated with this automation peer. |
| GetItemType | Gets the item type that is associated with this automation peer. |
| GetLabeledBy | Gets the automation peer for the label that is targeted to the element. |
| GetLandmarkType | Gets the control type for the element that is associated with the UI Automation peer. |
| GetLiveSetting | Gets the current live setting that is associated with this this automation peer. |
| GetLocalizedControlType | Gets a human-readable localized string that represents the type of the control that is associated with this automation peer. |
| GetName | Gets text that describes the element that is associated with this automation peer. |
| GetParent | Gets the Avalonia.Automation.Peers.AutomationPeer that is the parent of this Avalonia.Automation.Peers.AutomationPeer. |
| GetPlaceholderText | Gets text that provides a placeholder for the element that is associated with this automation peer. |
| GetProvider | No summary available. |
| HasKeyboardFocus | Gets a value that indicates whether the element that is associated with this automation peer currently has keyboard focus. |
| IsContentElement | Gets a value that indicates whether the element that is associated with this automation peer contains data that is presented to the user. |
| 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. |
| IsEnabled | Gets a value indicating whether the control is enabled for user interaction. |
| IsKeyboardFocusable | Gets a value that indicates whether the element can accept keyboard focus. |
| IsOffscreen | Gets a value that indicates whether an element is off the screen. |
| RaisePropertyChangedEvent | Raises an event to notify the automation client of a changed property value. |
| SetFocus | Sets the keyboard focus on the element that is associated with this automation peer. |
| ShowContextMenu | Shows the context menu for the element that is associated with this automation peer. |
BringIntoView Method
Attempts to bring the element associated with the automation peer into view.
public void BringIntoView()
GetAcceleratorKey Method
Gets the accelerator key combinations for the element that is associated with the UI Automation peer.
public string GetAcceleratorKey()
Returns
string
Remarks
An accelerator key (sometimes called a shortcut key) exposes a key combination for which can be used to invoke an action, for example, an "Open..." menu item on Windows often has an accelerator key of "Ctrl+O".
- Windows
UIA_AcceleratorKeyPropertyId - macOSNo mapping
GetAccessKey Method
Gets the access key for the element that is associated with the automation peer.
public string GetAccessKey()
Returns
string
Remarks
An access key (sometimes called a mnemonic) is a character in the text of a menu, menu item, or label of a control such as a button, that activates the associated function. For example, to open the File menu, for which the access key is typically F, the user would press ALT+F.
- Windows
UIA_AccessKeyPropertyId - macOSNo mapping
GetAutomationControlType Method
Gets the control type for the element that is associated with the UI Automation peer.
public Avalonia.Automation.Peers.AutomationControlType GetAutomationControlType()
Returns
Avalonia.Automation.Peers.AutomationControlType
Remarks
Gets the type of the element.
- Windows
UIA_ControlTypePropertyId - macOS
NSAccessibilityProtocol.accessibilityRole
GetAutomationId Method
Gets the automation ID of the element that is associated with the UI Automation peer.
public string GetAutomationId()
Returns
string
Remarks
- Windows
UIA_AutomationIdPropertyId - macOS
NSAccessibilityProtocol.accessibilityIdentifier
GetBoundingRectangle Method
Gets the bounding rectangle of the element that is associated with the automation peer in top-level coordinates.
public Avalonia.Rect GetBoundingRectangle()
Returns
Remarks
- Windows
IRawElementProviderFragment.get_BoundingRectangle - macOS
NSAccessibilityProtocol.accessibilityFrame
GetChildren Method
Gets the child automation peers.
public System.Collections.Generic.IReadOnlyList<Avalonia.Automation.Peers.AutomationPeer> GetChildren()
Returns
System.Collections.Generic.IReadOnlyList<Avalonia.Automation.Peers.AutomationPeer>
Remarks
- Windows
IRawElementProviderFragment.Navigate - macOS
NSAccessibilityProtocol.accessibilityChildren
GetClassName Method
Gets a string that describes the class of the element.
public string GetClassName()
Returns
string
Remarks
A string containing the class name for the automation element as assigned by the control developer. This is often the C# class name of the control.
- Windows
UIA_ClassNamePropertyId - macOSNo mapping.
GetHeadingLevel Method
Gets the heading level that is associated with this automation peer.
public int GetHeadingLevel()
Returns
int
Remarks
- Windows
UIA_HeadingLevelPropertyId - macOS
NSAccessibilityProtocol.accessibilityValue
GetHelpText Method
Gets text that provides help for the element that is associated with this automation peer.
public string GetHelpText()
Returns
string
Remarks
- Windows
UIA_HelpTextPropertyId - macOS
NSAccessibilityProtocol.accessibilityHelp
GetItemStatus Method
Gets the item status that is associated with this automation peer.
public string GetItemStatus()
Returns
string
Remarks
- Windows
UIA_ItemStatusPropertyId - macOSNo mapping.
GetItemType Method
Gets the item type that is associated with this automation peer.
public string GetItemType()
Returns
string
Remarks
- Windows
UIA_ItemTypePropertyId - macOSNo mapping.
GetLabeledBy Method
Gets the automation peer for the label that is targeted to the element.
public Avalonia.Automation.Peers.AutomationPeer GetLabeledBy()
Returns
Avalonia.Automation.Peers.AutomationPeer
Remarks
Identifies an automation peer representing an element which that contains the text label for this element.
- Windows
UIA_LabeledByPropertyId(not yet implemented) - macOS
NSAccessibilityProtocol.accessibilityLabelUIElements(not yet implemented)
GetLandmarkType Method
Gets the control type for the element that is associated with the UI Automation peer.
public Nullable<Avalonia.Automation.Peers.AutomationLandmarkType> GetLandmarkType()
Returns
Nullable<Avalonia.Automation.Peers.AutomationLandmarkType>
Remarks
Gets the type of the element.
- Windows
UIA_LandmarkTypePropertyId,UIA_LocalizedLandmarkTypePropertyId - macOS
NSAccessibilityProtocol.accessibilityRole,NSAccessibilityProtocol.accessibilitySubrole
GetLiveSetting Method
Gets the current live setting that is associated with this this automation peer.
public Avalonia.Automation.AutomationLiveSetting GetLiveSetting()
Returns
Avalonia.Automation.AutomationLiveSetting
The live setting to use for automation.
GetLocalizedControlType Method
Gets a human-readable localized string that represents the type of the control that is associated with this automation peer.
public string GetLocalizedControlType()
Returns
string
Remarks
- Windows
UIA_LocalizedControlTypePropertyId(not yet implemented) - macOSNo mapping.
GetName Method
Gets text that describes the element that is associated with this automation peer.
public string GetName()
Returns
string
Remarks
- Windows
UIA_NamePropertyId(not yet implemented) - macOS When the control type is Avalonia.Automation.Peers.AutomationControlType.Text, this value is exposed by both
NSAccessibilityProtocol.accessibilityTitleandNSAccessibilityProtocol.accessibilityValue.
GetParent Method
Gets the Avalonia.Automation.Peers.AutomationPeer that is the parent of this Avalonia.Automation.Peers.AutomationPeer.
public Avalonia.Automation.Peers.AutomationPeer GetParent()
Returns
Avalonia.Automation.Peers.AutomationPeer
Remarks
- Windows
IRawElementProviderFragment.Navigate - macOS
NSAccessibilityProtocol.accessibilityParent
GetPlaceholderText Method
Gets text that provides a placeholder for the element that is associated with this automation peer.
public string GetPlaceholderText()
Returns
string
Remarks
- WindowsNo mapping.
- macOS
NSAccessibilityProtocol.accessibilityPlaceholderValue
GetProvider Method
public T GetProvider<T>()
Type Parameters
T
Returns
T
HasKeyboardFocus Method
Gets a value that indicates whether the element that is associated with this automation peer currently has keyboard focus.
public bool HasKeyboardFocus()
Returns
bool
Remarks
- Windows
UIA_HasKeyboardFocusPropertyId - macOS
NSAccessibilityProtocol.isAccessibilityFocused
IsContentElement Method
Gets a value that indicates whether the element that is associated with this automation peer contains data that is presented to the user.
public bool IsContentElement()
Returns
bool
Remarks
- Windows
UIA_IsContentElementPropertyId - macOSNo mapping.
IsControlElement Method
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.
public bool IsControlElement()
Returns
bool
Remarks
- Windows
UIA_IsControlElementPropertyId - macOS
NSAccessibilityProtocol.isAccessibilityElement
IsEnabled Method
Gets a value indicating whether the control is enabled for user interaction.
public bool IsEnabled()
Returns
bool
Remarks
- Windows
UIA_IsEnabledPropertyId - macOS
NSAccessibilityProtocol.isAccessibilityEnabled
IsKeyboardFocusable Method
Gets a value that indicates whether the element can accept keyboard focus.
public bool IsKeyboardFocusable()
Returns
bool
Remarks
- Windows
UIA_IsKeyboardFocusablePropertyId - macOSNo mapping.
IsOffscreen Method
Gets a value that indicates whether an element is off the screen.
public bool IsOffscreen()
Returns
bool
Remarks
This property does not indicate whether the element is visible. In some circumstances, an element is on the screen but is still not visible. For example, if the element is on the screen but obscured by other elements, it might not be visible. In this case, the method returns false.
- Windows
UIA_IsOffscreenPropertyId - macOSNo mapping.
RaisePropertyChangedEvent Method
Raises an event to notify the automation client of a changed property value.
public void RaisePropertyChangedEvent(Avalonia.Automation.AutomationProperty property, object oldValue, object newValue)
Parameters
property Avalonia.Automation.AutomationProperty
The property that changed.
oldValue object
The previous value of the property.
newValue object
The new value of the property.
SetFocus Method
Sets the keyboard focus on the element that is associated with this automation peer.
public void SetFocus()
ShowContextMenu Method
Shows the context menu for the element that is associated with this automation peer.
public bool ShowContextMenu()
Returns
bool
true if a context menu is present for the element; otherwise false.
Events
| Name | Description |
|---|---|
| ChildrenChanged | Occurs when the children of the automation peer have changed. |
| PropertyChanged | Occurs when a property value of the automation peer has changed. |
ChildrenChanged Event
Occurs when the children of the automation peer have changed.
public event EventHandler ChildrenChanged
PropertyChanged Event
Occurs when a property value of the automation peer has changed.
public event EventHandler<Avalonia.Automation.AutomationPropertyChangedEventArgs> PropertyChanged