In my WPF app I'm trying to get the AutomationElement of a UWP app window.
This is my code:
AutomationElement root = AutomationElement.RootElement;
PropertyCondition condition = new PropertyCondition(AutomationElement.NameProperty, "Calculator");
AutomationElementCollection collection = root.FindAll(TreeScope.Children, condition);
This code works. The problem is when this window is in fullscreen mode.
You can reproduce the mode by opening the calculator and pressing win+shift+enter
.
When the window is in fullscreen mode I can't get it in the collection.
Am I missing something?
The reason I'm trying to have the AutomationElement is because I want to give focus to this window of an external application.
Is there a better way to do this?