Skip to main content

ListBoxEdit.SelectionMode Property

Gets or sets how list items are selected. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v23.2.dll

NuGet Package: DevExpress.Wpf.Core

Declaration

public SelectionMode SelectionMode { get; set; }

Property Value

Type Description
SelectionMode

A SelectionMode enumeration value that specifies the editor’s selection behavior.

Remarks

Use the SelectionMode property to specify how many items a user can select at once, and the ways the user can perform multiple selections. By default, the list box editor functions in single selection mode - items can only be selected one at a time.

listBox_SelectedItems

Setting the SelectionMode property to Extended, enables multiple item selection. An end user can select a continuous range of items by clicking them (or using the UP ARROW, DOWN ARROW, PgUp or PgDn) while holding the SHIFT key down. This extends the selection from the previously selected to the current item. Pressing CTRL and clicking the mouse toggles an item’s selected state.

Note

The editor’s EditValue property returns a List<T><Object,> of selected items when multiple items are selected. This List<T><Object,> is recreated each time the selection is changed. Changing the collection of items returned by the EditValue property does not affect the actual set of selected items.

Use the ListBoxEdit.SelectedItems property to edit a collection of selected items in code.

If the SelectionMode property is set to Multiple, a mouse click or pressing the SPACEBAR selects or deselects an item in the list.

Each time the selection changes, the ListBoxEdit.SelectedIndexChanged event is fired.

Note

If the ListBoxEdit represents a checked list, the SelectionMode property is set to Multiple and cannot be changed.

If the ListBoxEdit represents a radio list, the SelectionMode property is set to Single and cannot be changed.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SelectionMode property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also