Slider
Shared behavior of horizontal and vertical sliders.
Use HSlider or VSlider. Inherited Value stores the number, MinValue/MaxValue define bounds and Step defines numeric snapping. TickCount and TicksPosition only configure tick drawing: they do not snap Value to tick marks. For fractional values without a grid, set Step = 0 and Rounded = false.
Editable = false disables user input while retaining programmatic Value writes. Scrollable = false disables the wheel while retaining other permitted input. The wheel uses Step; final values pass through Range rules.
DragStarted/DragEnded describe mouse dragging. Programmatic Value writes do not emit them. DragEnded’s valueChanged compares normalized positions at the start and end: moving away and back can produce false. Use ValueChanged for ordinary value reactions, subject to Range exceptions.
TickCount defaults to 0; fewer than two ticks draw no marks. TicksOnBorders controls endpoint marks; intermediate ticks are evenly spaced rather than derived from Step. Horizontal direction respects RTL; vertical values increase upward.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties5
EditableProperty
public bool Editable { get; set; }Allows user input, default true. false disables user actions and clears active dragging; programmatic Value writes remain available.
ScrollableProperty
public bool Scrollable { get; set; }Allows mouse-wheel changes, default true. false does not disable dragging, keys or programmatic assignment. Editable = false still blocks input.
TickCountProperty
public int TickCount { get; set; }Number of evenly spaced ticks, default 0. Fewer than two are not drawn. Does not set Step or constrain Value; TicksOnBorders separately controls endpoint marks.
TicksOnBordersProperty
public bool TicksOnBorders { get; set; }Draw endpoint ticks, default false. TickCount = 2 with false skips both marks. Does not affect Range bounds or snapping.
TicksPositionProperty
public Slider.TickPosition TicksPosition { get; set; }Tick placement: BottomRight, TopLeft, Both or Center. Default BottomRight. Affects drawing rather than Value or tick count.
Methods10
GetTicksint
public int GetTicks();Number of evenly spaced ticks, default 0. Fewer than two are not drawn. Does not set Step or constrain Value; TicksOnBorders separately controls endpoint marks.
intCurrent setting rather than confirmation of input or visual validation.
GetTicksOnBordersbool
public bool GetTicksOnBorders();Draw endpoint ticks, default false. TickCount = 2 with false skips both marks. Does not affect Range bounds or snapping.
boolCurrent setting rather than confirmation of input or visual validation.
GetTicksPositionSlider.TickPosition
public Slider.TickPosition GetTicksPosition();Tick placement: BottomRight, TopLeft, Both or Center. Default BottomRight. Affects drawing rather than Value or tick count.
Slider.TickPositionCurrent setting rather than confirmation of input or visual validation.
IsEditablebool
public bool IsEditable();Allows user input, default true. false disables user actions and clears active dragging; programmatic Value writes remain available.
boolCurrent setting rather than confirmation of input or visual validation.
IsScrollablebool
public bool IsScrollable();Allows mouse-wheel changes, default true. false does not disable dragging, keys or programmatic assignment. Editable = false still blocks input.
boolCurrent setting rather than confirmation of input or visual validation.
SetEditablevoid
public void SetEditable(bool editable);Allows user input, default true. false disables user actions and clears active dragging; programmatic Value writes remain available.
| Name | Type | Default |
|---|---|---|
editable | bool | — |
editableAllows user input, default true. false disables user actions and clears active dragging; programmatic Value writes remain available.
SetScrollablevoid
public void SetScrollable(bool scrollable);Allows mouse-wheel changes, default true. false does not disable dragging, keys or programmatic assignment. Editable = false still blocks input.
| Name | Type | Default |
|---|---|---|
scrollable | bool | — |
scrollableAllows mouse-wheel changes, default true. false does not disable dragging, keys or programmatic assignment. Editable = false still blocks input.
SetTicksvoid
public void SetTicks(int count);Number of evenly spaced ticks, default 0. Fewer than two are not drawn. Does not set Step or constrain Value; TicksOnBorders separately controls endpoint marks.
| Name | Type | Default |
|---|---|---|
count | int | — |
countNumber of evenly spaced ticks, default 0. Fewer than two are not drawn. Does not set Step or constrain Value; TicksOnBorders separately controls endpoint marks.
SetTicksOnBordersvoid
public void SetTicksOnBorders(bool ticksOnBorder);Draw endpoint ticks, default false. TickCount = 2 with false skips both marks. Does not affect Range bounds or snapping.
| Name | Type | Default |
|---|---|---|
ticksOnBorder | bool | — |
ticksOnBorderDraw endpoint ticks, default false. TickCount = 2 with false skips both marks. Does not affect Range bounds or snapping.
SetTicksPositionvoid
public void SetTicksPosition(Slider.TickPosition ticksOnBorder);Tick placement: BottomRight, TopLeft, Both or Center. Default BottomRight. Affects drawing rather than Value or tick count.
| Name | Type | Default |
|---|---|---|
ticksOnBorder | Slider.TickPosition | — |
ticksOnBorderSlider.TickPosition tick placement. Parameter name ticksOnBorder does not mean bool.
Signals and events2
DragEndedEvent
public event Slider.DragEndedEventHandler DragEnded;End of dragging. valueChanged compares normalized positions at the start and end rather than detecting any intermediate motion. Programmatic Value assignment does not emit it.
| Name | Type | Default |
|---|---|---|
valueChanged | bool | — |
valueChangedtrue when final normalized position differs from its initial position; not a record of any intermediate motion.
DragStartedEvent
public event Action DragStarted;Beginning of mouse dragging. Ordinary Value writes and wheel changes do not form this drag-signal pair. Use ValueChanged for values.
Slider.TickPosition
| Value | Description |
|---|---|
Both = 2 | Places the ticks at the both sides of the slider. |
BottomRight = 0 | Places the ticks at the bottom of the |
Center = 3 | Places the ticks at the center of the slider. |
TopLeft = 1 | Places the ticks at the top of the |
Theme properties
These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.
| Key and type | Description |
|---|---|
center_grabberint | Boolean constant. If 0 |
grabber_max_sizeint | The maximum allowed size of the 0 |
grabber_offsetint | Vertical or horizontal offset of the grabber. Default:0 |
tick_max_sizeint | The maximum allowed size of the 0 |
tick_offsetint | Vertical or horizontal offset of the ticks. The offset is reversed for top or left ticks. Default:0 |
grabberTexture2D | The texture for the grabber (the draggable element). |
grabber_disabledTexture2D | The texture for the grabber when it's disabled. |
grabber_highlightTexture2D | The texture for the grabber when it's focused. |
tickTexture2D | The texture for the ticks, visible when |
drag_ended_soundAudioStream | Played when mouse or touch drag ends. This is also used by |
drag_started_soundAudioStream | Played when mouse or touch drag begins. This is also used by |
focus_soundAudioStream | Played when this |
value_change_rejected_soundAudioStream | Played when the value is attempted to be changed through keyboard or gamepad input, but the value is already at the minimum (or maximum). |
value_changed_soundAudioStream | Played when the value is changed through keyboard or gamepad input. If the value is already at the minimum (or maximum), |
grabber_areaStyleBox | The background of the area to the left or bottom of the grabber. |
grabber_area_highlightStyleBox | The background of the area to the left or bottom of the grabber that displays when it's being hovered or focused. |
sliderStyleBox | The background for the whole slider. Affects the height or width of the |