我们如何检查是否选择了AutomationElement c#

时间:2013-07-30 11:20:30

标签: c# microsoft-ui-automation

如果选择了AutomationElement,是否有任何方法可以获得。我使用以下代码来获取AutomationElement对象。

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

1 个答案:

答案 0 :(得分:0)

使用SelectionItem模式来确定是否选择了一个元素(显然,并非所有AutomationElements都实现了这种模式 - 只有那些实际可以选择的模式。如果没有,你可以使用IsFocused财产)。

相关问题