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