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;
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
Anders zommarin
source share