Description
How to read WPF AutomationProperties
in Test Studio.
Solution
Automation properties are defined as a set of an attached properties of a WPF element, so you can read them using GetAttachedProperty
method.
Here's an example of how to read the ItemStatus
property:
var itemStatus = <Your-Wpf-Element>.GetAttachedProperty<string>("System.Windows.Automation.AutomationProperties", "ItemStatus");
Note The code above will work only when automation property values are set in the XAML of your WPF application.