我有一个对象树,它有一个父表内的行对象。我试图把所有这些行成AutomationElementCollection
使用Windows.Automation,我可以通过正则表达式找到AutomationElement吗?
AutomationElementCollection asdf = ParentTableObj.FindAll
(
TreeScope.Children,
new PropertyCondition
(
AutomationElement.NameProperty,
"I want to use regex here"
)
);
的所有行AutomationElement.NameProperty
包含字符串‘行’。然而,它们是该字符串的变体 - 例如“ROW1”,“行2”,“TopRow”,...
好像我可能失去了一些东西,因为FindAll
方法允许你定义TreeScope
和发现任何AutomationElement
,其提供的Condition
参数相匹配。我只是希望我的病情不受限制,因为我已经可以通过TreeScope
控制查找范围。
FindDescendant好像没有定义 – 2016-04-13 16:36:39
@John Smith,我更新了答案,名字改名为FindFirstDescendant。 – 2016-04-13 16:41:05