Table of Contents

Property SelectedItem

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

SelectedItem

Gets or sets the currently selected item in the ListBox.

[Browsable(false)]
public override 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

For a standard ListBox, you can use this property to determine the index of the item that is selected in the ListBox. If the SelectionMode property of the ListBox is set to either Multiple (which indicates a multiple-selection ListBox) 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 ListBox, use the SelectedItems property. If you want to obtain the index position of the currently selected item in the ListBox, use the SelectedIndex property. In addition, you can use the SelectedIndices property to obtain all the selected indexes in a multiple-selection ListBox.