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)); }
public Window(AutomationElement automationElement) : this(automationElement, Equals(automationElement.Parent(), Desktop.AutomationElement)) { }
public static SelectionItemControl Create(AutomationElement automationElement) { return(Conditions.IsMatch(automationElement.Parent(), Conditions.ComboBox) ? (SelectionItemControl) new ComboBoxItem(automationElement) : new ListBoxItem(automationElement)); }