Table of Contents

Class Slider<T>

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Provides a slider control letting the user navigate from a set of typed options in a linear manner using the keyboard or mouse.

public class Slider<T> : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IOrientation

Type Parameters

T
Inheritance
Slider<T>
Implements
Derived
Inherited Members

Constructors

Slider()

Initializes a new instance of the Slider class.

Slider(List<T>, Orientation)

Initializes a new instance of the Slider class.

Properties

AllowEmpty

Allow no selection.

FocusedOption

The focused option (has the cursor).

LegendsOrientation

Legends Orientation. Orientation

MinimumInnerSpacing

Gets or sets the minimum number of rows/columns between Options. The default is 1.

Options

Set the slider options.

Orientation

Gets or sets the Orientation. The default is Horizontal.

RangeAllowSingle

Allow range start and end be in the same option, as a single option.

ShowEndSpacing

Show/Hide spacing before and after the first and last option.

ShowLegends

Show/Hide the options legends.

Style

Slider styles. SliderStyle

Text

Setting the Text of a slider is a shortcut to setting options. The text is a CSV string of the options.

Type

Slider Type. SliderType

UseMinimumSize

Gets or sets whether the minimum or ideal size will be used when calculating the size of the slider.

Methods

ChangeOption(int, bool)

Sets or unsets optionIndex based on set.

GetIdealHeight()

Gets the ideal height of the slider. The ideal height is the minimum height required to display all options and inner spacing.

GetIdealWidth()

Gets the ideal width of the slider. The ideal width is the minimum width required to display all options and inner spacing.

GetSetOptions()

Get the indexes of the set options.

OnDrawingContent()

Called when the View's content is to be drawn. The default implementation does nothing.

OnMouseEvent(MouseEventArgs)

Called when a mouse event occurs within the view's Viewport.

OnOptionFocused(int, SliderEventArgs<T>)

Overridable function that fires the OptionFocused event.

OnOptionsChanged()

Overridable method called when the slider options have changed. Raises the OptionsChanged event.

OnOrientationChanged(Orientation)

Called when Orientation has been changed.

PositionCursor()

Positions the cursor in the right position based on the currently focused view in the chain.

SetOption(int)

Causes the specified option to be set and be focused.

UnSetOption(int)

Causes the specified option to be un-set and be focused.

Events

OptionFocused

Event raised When the option is hovered with the keys or the mouse.

OptionsChanged

Event raised when the slider option/s changed. The dictionary contains: key = option index, value = T

OrientationChanged

Raised when Orientation has changed.

OrientationChanging

Raised when Orientation is changing. Can be cancelled.