Property SelectedItems
SelectedItems
Gets a collection containing the currently selected items in the ListBox.
[Browsable(false)]
public virtual IReadOnlyList<object> SelectedItems { get; }
Property Value
- IReadOnlyList<object>
A IReadOnlyList<T> containing the currently selected items in the control.
Remarks
For a multiple-selection ListBox, this property returns a collection containing the indexes to all items that are selected in the ListBox. For a single-selection ListBox, this property returns a collection containing a single element containing the index of the only selected item in the ListBox.
The ListBox class provides a number of ways to reference selected items. Instead of using the SelectedIndices property to obtain the index position of the currently selected item in a single-selection ListBox, you can use the SelectedIndex property. If you want to obtain the item that is currently selected in the ListBox, instead of the index position of the item, use the SelectedItem property. In addition, you can use the SelectedIndices property to obtain all the selected indexes in a multiple-selection ListBox.