SelectionItemPattern
支持SelectionItemPattern的控件有ListView、ListBox、RadioButton、GridView等。
1. SelectionItemPattern的三个重要方法:
1. AddToSelection:将当前元素添加到所选项的集合。
2. RemoveFromSelection: 从选定项的集合中移除当前元素。
3. Select: 取消所有已选中的项,然后选择当前元素。
2. SelectionItemPattern的Current属性
可通过Current属性的IsSelected属性来判断AutomationElement是否被selected.
如下代码演示了使用SelectionItemPattern来操作RadioButton控件。
以下代码为XAML:
本文简单介绍了SelectionItemPattern以及使用SelectionItemPattern来操作RadioButton。