Property SelectedItem
SelectedItem
Gets or sets the currently selected item in the control.
[Browsable(false)]
public object? SelectedItem { get; set; }
Property Value
- object
An object that represents the current selection in the control, or
null
if no item is selected.
Remarks
When single selection mode is used, you can use this property to determine the index of the item that is selected in the control. If the SelectionMode property of the control is set to either Multiple (which indicates a multiple-selection control) and multiple items are selected in the list, this property can return the index to any selected item.
To retrieve a collection containing all selected items in a multiple-selection control, use the SelectedItems property. If you want to obtain the index position of the currently selected item in the control, use the SelectedIndex property. In addition, you can use the SelectedIndices property to obtain all the selected indexes in a multiple-selection control.