public static UiElement FromAutomationElement(AutomationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            foreach (var conditionAndCreate in ConditionAndCreates)
            {
                if (conditionAndCreate.TryCreate(element, out var uiElement))
                {
                    if (element.Parent() is AutomationElement parent &&
                        Conditions.IsMatch(parent, Conditions.ListViewItem))
                    {
                        return(new GridViewCell(uiElement));
                    }

                    return(uiElement);
                }
            }

            return(new UiElement(element));
        }
Exemplo n.º 2
0
 public Window(AutomationElement automationElement)
     : this(automationElement, Equals(automationElement.Parent(), Desktop.AutomationElement))
 {
 }
Exemplo n.º 3
0
 public static SelectionItemControl Create(AutomationElement automationElement)
 {
     return(Conditions.IsMatch(automationElement.Parent(), Conditions.ComboBox)
         ? (SelectionItemControl) new ComboBoxItem(automationElement)
         : new ListBoxItem(automationElement));
 }