Я хочу показать все элементы управления приложения для автоматизации пользовательского интерфейса, такие как UI Explorer. Я получил данные приложения, но они не отформатированы (не показаны сгруппированные данные).
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;
}
![enter image description here](https://i.stack.imgur.com/wHtuy.png)