Table of Contents

Class LinearRange<T>

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

A linear range view representing a contiguous range of options. The current value is a LinearRangeSpan<T> whose Kind is one of None, LeftBounded, RightBounded, or Closed.

public class LinearRange<T> : LinearRangeViewBase<T, LinearRangeSpan<T>>, IDisposable, ISupportInitializeNotification, ISupportInitialize, IOrientation, IValue<LinearRangeSpan<T>>, IValue, IDesignable

Type Parameters

T

The data type of the options.

Inheritance
LinearRange<T>
Implements
Derived
Inherited Members
Extension Methods

Remarks

To switch between left-bounded, right-bounded, and closed range modes, set RangeKind. Setting RangeKind migrates the current Value, dropping fields that are no longer relevant.

To change the selection programmatically, set Value. Empty selections may be represented either by Empty or by a span of any LinearRangeSpanKind with no matching options.

Constructors

LinearRange()

Initializes a new instance of LinearRange<T>.

LinearRange(List<T>?, Orientation)

Initializes a new instance of LinearRange<T>.

Properties

RangeAllowSingle

Gets or sets whether the range is allowed to collapse to a single option (only meaningful when RangeKind is Closed).

RangeKind

Gets or sets the kind of range. The default is Closed.

Value

Gets or sets the value.

Methods

EnableForDesign()

Loads demo data suitable for a designer preview: a closed range of work hours (8 AM through 6 PM in one-hour increments) with the range preset to "9 AM"–"5 PM". Only populated when T is string; for any other type, the view is left untouched and false is returned.

OnSelectionChanged()

Called by the base when the selected indices have changed due to user input. Concrete subclasses must compute their Value from the current selection and raise ValueChanged / ValueChangedUntyped.