Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.6 KB

listbox_selectionmode.md

File metadata and controls

41 lines (30 loc) · 2.6 KB
-api-id -api-type
P:Microsoft.UI.Xaml.Controls.ListBox.SelectionMode
winrt property

Microsoft.UI.Xaml.Controls.ListBox.SelectionMode

-description

Gets or sets the selection behavior for the ListBox control.

-xaml-syntax

<ListBox SelectionMode="selectionModeValue"/>

-xaml-values

selectionModeValue
selectionModeValueA named constant of the SelectionMode enumeration, such as Extended.
## -property-value One of the [SelectionMode](selectionmode.md) values.

-remarks

By default, a user can select a single item in a ListBox. You can set the ListBox.SelectionMode property to a SelectionMode enumeration value to enable multi-selection. Here are the selection mode values.

Mode Behavior
Single 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.
Multiple 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.
Extended With 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.

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.

-examples

-see-also

Selector.SelectedItem, SelectedItems