我拥有一个网格。我想获取特定行的网格计数(不包括特定值的行)。如何使用编码 UI 获取此类条件的网格计数?
最佳答案
我会创建一个列表,然后循环访问行的集合,并将符合您需求的行添加到列表中。然后,只需计算列表中的对象即可。
UITestControlCollection myRows = rowDefinition.FindMatchingControls();
list<string> matchingRows = new list<string>();
foreach (UITestControl control in myRows)
{
if (!control.GetProperty("InnerText").ToString().Contains("myValue"))
matchingRows.Add(control.GetProperty("ID").ToString());
}
int theRowsIWant = matchingRows.Count;
关于.net - 使用编码 ui 检索特定行的网格计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30763690/