Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 842 Bytes

read-wpf-automation-properties.md

File metadata and controls

24 lines (19 loc) · 842 Bytes
title description type page_title slug tags res_type
Read WPF AutomationProperties in Test Studio
Learn how to read WPF AutomationProperties in Test Studio.
how-to
Read WPF AutomationProperties in Test Studio
read-wpf-automation-properties
automation, WPF, Test Studio
kb

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.