ListViewBase.SelectionMode Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the selection behavior for a ListViewBase instance.
public:
property ListViewSelectionMode SelectionMode { ListViewSelectionMode get(); void set(ListViewSelectionMode value); };
ListViewSelectionMode SelectionMode();
void SelectionMode(ListViewSelectionMode value);
public ListViewSelectionMode SelectionMode { get; set; }
var listViewSelectionMode = listViewBase.selectionMode;
listViewBase.selectionMode = listViewSelectionMode;
Public Property SelectionMode As ListViewSelectionMode
<listViewBase SelectionMode="listViewSelectionModeMemberName" />
Property Value
One of the ListViewSelectionMode enumeration values. The default is Single selection.
Remarks
By default, a user can select a single item in a view. You can set the SelectionMode property to a ListViewSelectionMode enumeration value to enable multi-selection or to disable selection. Here are the selection mode values.
None | Item selection is disabled. |
Single | With no modifier keys:
|
Multiple | With no modifier keys:
|
Extended | With no modifier keys:
|
Note
Touch interactions are enabled only when IsSwipeEnabled is true.
If SelectionMode is None, and CanDragItems and CanReorderItems are false, you should set IsSwipeEnabled to false to improve app performance. See the IsSwipeEnabled property for more info.
When SelectionMode is Single, use the Selector.SelectedItem property to get the item that's selected. When SelectionMode is Multiple or Extended, use the SelectedItems property to get the items that are selected.
When item selection is disabled, you can make items respond to a user click like a button instead of being selected. To do this, set SelectionMode to None, the IsItemClickEnabled property to true, and handle the ItemClick event.
For more info and examples, see How to change the interaction mode.