我想显示UI自动化之类的UI自动化应用程序的所有控件。我收到了应用程序的数据,但未格式化(未显示分组的数据)。
public List<AutomationElementInformation> getChild(AutomationElement parentDatagrid)
{
List<AutomationElementInformation> listAEI = new List<AutomationElementInformation>();
System.Windows.Automation.Condition yourCond = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem);
AutomationElementCollection aECollection;
aECollection = parentDatagrid.FindAll(TreeScope.Children|TreeScope.Descendants, System.Windows.Automation.Condition.TrueCondition);
foreach (AutomationElement element in aECollection)
{
// var controlTypeNoDefault = element.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty, true);
AutomationElementInformation AEi = element.Current;
listAEI.Add(AEi);
}
return listAEI;
}