AutomationProperties class

Applies to Windows and Windows Phone

Provides support for getting or setting instance-level values of automation properties. These property values are set as attached properties (typically in XAML) and supplement or override automation property values from a control's AutomationPeer.

Inheritance

Object
  AutomationProperties

Syntax


public ref class AutomationProperties sealed 

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The AutomationProperties class has these types of members:

Methods

The AutomationProperties class has these methods. It also inherits methods from the Object class.

MethodDescription
GetAcceleratorKey Gets the value of the AutomationProperties.AcceleratorKey attached property for the specified DependencyObject.
GetAccessibilityView Gets the value of the AutomationProperties.AccessibilityView attached property for the specified DependencyObject.
GetAccessKey Gets the value of the AutomationProperties.AccessKey attached property for the specified DependencyObject.
GetAutomationId Gets the value of the AutomationProperties.AutomationId attached property for the specified DependencyObject.
GetControlledPeers A static utility method that retrieves the list of controlled peers from a target owner.
GetHelpText Gets the value of the AutomationProperties.HelpText attached property for the specified DependencyObject.
GetIsRequiredForForm Gets the value of the AutomationProperties.IsRequiredForForm attached property for the specified DependencyObject.
GetItemStatus Gets the value of the AutomationProperties.ItemStatus attached property for the specified DependencyObject.
GetItemType Gets the value of the AutomationProperties.ItemType attached property for the specified DependencyObject.
GetLabeledBy Gets the value of the AutomationProperties.LabeledBy attached property for the specified DependencyObject.
GetLiveSetting Gets the value of the AutomationProperties.LiveSetting attached property for the specified DependencyObject.
GetName Gets the value of the AutomationProperties.Name attached property for the specified DependencyObject.
SetAcceleratorKey Sets the value of the AutomationProperties.AcceleratorKey attached property for the specified DependencyObject.
SetAccessibilityView Sets the value of the AutomationProperties.AccessibilityView attached property for the specified DependencyObject.
SetAccessKey Sets the value of the AutomationProperties.AccessKey attached property for the specified DependencyObject.
SetAutomationId Sets the value of the AutomationProperties.AutomationId attached property for the specified DependencyObject.
SetHelpText Sets the value of the AutomationProperties.HelpText attached property for the specified DependencyObject.
SetIsRequiredForForm Sets the value of the AutomationProperties.IsRequiredForForm attached property for the specified DependencyObject.
SetItemStatus Sets the value of the AutomationProperties.ItemStatus attached property for the specified DependencyObject.
SetItemType Sets the value of the AutomationProperties.ItemType attached property for the specified DependencyObject.
SetLabeledBy Sets the value of the AutomationProperties.LabeledBy attached property for the specified DependencyObject.
SetLiveSetting Sets the value of the AutomationProperties.LiveSetting attached property for the specified DependencyObject.
SetName Sets the value of the AutomationProperties.Name attached property for the specified DependencyObject.

 

Attached Properties

The AutomationProperties class has these attached properties.

Access typeDescription

AutomationProperties.AcceleratorKey

Read/writeGets or sets the accelerator key for the specified element.

AutomationProperties.AccessibilityView

Read/writeGets or sets the Microsoft UI Automation tree view mode for an element.

AutomationProperties.AccessKey

Read/writeGets or sets the access key for the specified element.

AutomationProperties.AutomationId

Read/writeGets or sets the string that uniquely identifies the element to UI Automation.

AutomationProperties.HelpText

Read/writeGets or sets the help text for the element.

AutomationProperties.IsRequiredForForm

Read/writeGets or sets a value that indicates whether the element is required to be filled out on a form.

AutomationProperties.ItemStatus

Read/writeGets or sets a description of the status of an item in an element.

AutomationProperties.ItemType

Read/writeGets or sets a description of the type of the specified element.

AutomationProperties.LabeledBy

Read/writeGets or sets the element that contains the text label for the element.

AutomationProperties.LiveSetting

Read/writeGets or sets the live setting value for the specified element.

AutomationProperties.Name

Read/writeGets or sets the UI Automation name of the element.

 

Properties

The AutomationProperties class has these properties.

PropertyAccess typeDescription

AcceleratorKeyProperty

Read-onlyIdentifies the AutomationProperties.AcceleratorKey attached property.

AccessibilityViewProperty

Read-onlyIdentifies the AutomationProperties.AccessibilityView attached property.

AccessKeyProperty

Read-onlyIdentifies the AutomationProperties.AccessKey attached property.

AutomationIdProperty

Read-onlyIdentifies the AutomationProperties.AutomationId attached property.

ControlledPeersProperty

Read-onlyIdentifies a dependency property that's used for controlled peers reporting information.

HelpTextProperty

Read-onlyIdentifies the AutomationProperties.HelpText attached property.

IsRequiredForFormProperty

Read-onlyIdentifies the AutomationProperties.IsRequiredForForm attached property.

ItemStatusProperty

Read-onlyIdentifies the AutomationProperties.ItemStatus attached property.

ItemTypeProperty

Read-onlyIdentifies the AutomationProperties.ItemType attached property.

LabeledByProperty

Read-onlyIdentifies the AutomationProperties.LabeledBy attached property.

LiveSettingProperty

Read-onlyIdentifies the AutomationProperties.LiveSetting attached property.

NameProperty

Read-onlyIdentifies the AutomationProperties.Name attached property.

 

Remarks

AutomationProperties XAML attached properties

AutomationProperties is the host service class for several XAML attached properties. The purpose of these attached properties is to enable setting various per-instance values that are pertinent to how a UI element is reported to the Microsoft UI Automation accessibility framework. This is useful in cases where the class design of the UI element doesn't already forward other UI-related property values as part of its UI Automation integration or peer implementation behavior, or where the value being forwarded is not the value you want to report to UI Automation.

These are the XAML attached properties that are supported by AutomationProperties:

In order to support XAML processor access to the attached properties, and also to expose equivalent get and set operations to code, each XAML attached property has a pair of Get and Set accessor methods, which are also members of AutomationProperties. For example, the GetName and SetName methods support and provide the equivalent code-only support for reporting automation Name values to UI Automation, instead of using AutomationProperties.Name to set it in XAML. Alternatively, you can use the dependency property system to get or set the value of the attached property, and this also reports the underlying value to UI Automation. Call GetValue or SetValue, passing the arguments of the dependency property identifier to set, and a reference to the target object on which to get or set the value.

AutomationProperties.Name

Of the various attached properties, probably the most important one is AutomationProperties.Name. This is because it is the Name property that is most frequently accessed and reported by assistive technologies when users interact with an app in an accessibility scenario. The Name serves as the human-readable identifier for the UI element.

Various UI elements have peer forwarding that can provide a default Name value based on other element properties. For example, the peer forwarding for the Button class will forward the ToString evaluation of the Button content and use this string as the default Name. In order to override that default, or to otherwise provide a Name value for any UI element case where there is no UI Automation Name available, set the AutomationProperties.Name attached property on that element in XAML. For more info on why a UI Automation Name is important, see Exposing basic information about UI elements. For more info on how to test whether an element already has a peer-supplied Name that is useful, see Testing your app for accessibility.

For localization reasons, you should avoid hard-coded string values for the AutomationProperties.Name in XAML. If you set x:Uid on the element, then you can use RESW resources to target the property and provide different values for localization. For attached properties, the resource identifier form requires full qualification of the attached property in XAML form, including its namespace and a using: prefix. For example, to target the AutomationProperties.Name attached property value on a resource that has x:Uid value of "sendButton", the name value of the data item in the RESW resources is sendButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name

Requirements

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]

Namespace

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

Metadata

Windows.winmd

See also

Accessibility for Windows Store apps using C#/VB/C++ and XAML
Exposing basic information about UI elements
Testing your app for accessibility
Attached properties overview
XAML accessibility sample

 

 

Show:
© 2014 Microsoft. All rights reserved.