0

Is there any way to get if an AutomationElement is selected or not. I have used following code to get an AutomationElement object.

System.Windows.Point point = new System.Windows.Point(Cursor.Position.X, Cursor.Position.Y);
AutomationElement  element = AutomationElement.FromPoint(point);
//how to know element is selected or not
kapill
  • 189
  • 9

1 Answers1

0

Use the SelectionItem pattern to determine if an element is selected or not (obviously, not all AutomationElements implement this pattern -- only those that can actually be selected. In case they don't, you may use the IsFocused property).

Tal Bronfer
  • 759
  • 5
  • 18