如何通过uiAutomation库获取分组控件的详细信息?

时间:2019-05-23 12:53:13

标签: c# wpf

我想显示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;
    }

enter image description here

0 个答案:

没有答案