Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 4.45 KB

listviewbase_selectionmode.md

File metadata and controls

63 lines (41 loc) · 4.45 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.ListViewBase.SelectionMode
winrt property

Windows.UI.Xaml.Controls.ListViewBase.SelectionMode

-description

Gets or sets the selection behavior for a ListViewBase instance.

-xaml-syntax

<listViewBase SelectionMode="listViewSelectionModeMemberName" />

-xaml-values

listViewSelectionModeMemberName
listViewSelectionModeMemberNameA named constant of the ListViewSelectionMode enumeration; for example, Extended.
## -property-value One of the [ListViewSelectionMode](listviewselectionmode.md) 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.

NoneItem selection is disabled.
SingleWith no modifier keys:
  • A user can select a single item using the space bar, mouse click, or touch tap.
  • A user can deselect an item using a downward swipe gesture.
While pressing Ctrl:
  • A user can deselect the item by using the space bar, mouse click, or touch tap.
  • Using the arrow keys, a user can move focus independently of selection.
MultipleWith no modifier keys:
  • A user can select multiple items using the space bar, mouse click, or touch tap to toggle selection on the focused item.
  • Using the arrow keys, a user can move focus independently of selection.
ExtendedWith no modifier keys:
  • The behavior is the same as Single selection.
While pressing Ctrl:
  • A user can select multiple items using the space bar, mouse click, or touch tap to toggle selection on the focused item.
  • Using the arrow keys, a user can move focus independently of selection.
While pressing Shift:
  • A user can select multiple contiguous items by clicking or tapping the first item in the selection and then the last item in the selection.
  • Using the arrow keys, a user can create a contiguous selection starting with the item selected when Shift is pressed.

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.

-examples

-see-also

SelectedItems, Selector.SelectedItem, Selector.SelectedIndex, Selector.SelectionChanged, How to change the interaction mode