LegacyAccessible on Windows.Automation

How to get LegacyAccessible.State and other LegacyAccessibles AutomationElement with C #? How Inspect.exe does it from tools.

+7
source share
1 answer

LegacyIAccessible is new and unavailable at the .NET level, as in .NET 4.0. But there is a project on CodePlex that has a newer implementation, which is in the 38718 set change .

Beware that you need to compile the project from source, the latest binary release is too old to hold back this, unfortunately ...

What you want to do is something like:

 if ((bool) child.GetCurrentPropertyValue(AutomationElementIdentifiers.IsLegacyIAccessiblePatternAvailableProperty)) { var pattern = ((LegacyIAccessiblePattern) child.GetCurrentPattern(LegacyIAccessiblePattern.Pattern)); var state = pattern.GetIAccessible().accState; // Do something with state... } 

The comments in the source code say that these are new features for Windows 7, but I get it to work with Windows XP SP3 ...

Hope this helps!

/ AZ

+6
source

All Articles