Table of Contents

Property SelectedIndex

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

SelectedIndex

Gets or sets the index of the currently selected option, or null if no option is selected. This is the unambiguous "no selection" surface for both reference and value types (compare with Value, where default(T) for value types may collide with a legitimately selected option).

public int? SelectedIndex { get; set; }

Property Value

int?

Remarks

To clear the selection, set to null. Requires AllowEmpty to be true; otherwise the clear is silently ignored (mirrors how Value behaves).

To select an option, set to its index in Options. Out-of-range values throw ArgumentOutOfRangeException.