Color legend plain property dependency property method event
A track with a thumb that picks a value between Min and Max. The same element is the scroll bar of scrollable elements: with ContentSize and ViewSize its thumb shows how much of the content is in view.
Slider derives from BaseElement and has its members too. The controls page shows it in context, with code and screenshots.
Names are colored by what they are: a plain property, a method, an event or a dependency property, which a style, a binding or an animation can set.
Properties
ButtonsSolidColor 🠆
Color · The color of the end buttons and caps, without textures. (150, 150, 160) unless set (DefaultSettings.DefaultSliderButtonsColor).
ContentSize 🠆
Point · The size of the content a scroll bar scrolls, in units. Changing it keeps the same content in view.
GeneralMouseCursorsSet 🠆
MouseCursorsSet · Static. The cursors of every element of this style type; null (the default) falls back to DefaultMouseCursorsSet.
GeneralStyle 🠆
SliderStyle · Static. The style of every element of this style type. It starts as a copy of the framework defaults; changing one of its properties updates every such element, a property it leaves unset takes its default.
LineDecreaseSolidColor 🠆
Color · The color of the track between the start and the thumb, without textures. (86, 156, 214) unless set (DefaultSettings.DefaultSliderLineDecreaseColor).
LineIncreaseSolidColor 🠆
Color · The color of the track between the thumb and the end, without textures. (150, 150, 160) unless set (DefaultSettings.DefaultSliderLineIncreaseColor).
Max 🠆
float · The largest value. Setting it below Min moves Min along. 1 unless set.
Min 🠆
float · The smallest value. Setting it above Max moves Max along. 0 unless set.
MouseCursorsSet 🠆
MouseCursorsSet · Read-only. The cursors the element shows: its override, else the set given to the control it is a part of, else its type’s general set, else DefaultMouseCursorsSet.
MouseCursorsSetOverride 🠆
MouseCursorsSet · The cursors of this element only, passed on to its parts that have none of their own.
MoveToPoint 🠆
bool · When set, a click on the track moves the thumb to the clicked point instead of stepping.
NormalizedValue 🠆
float · Read-only. Where the value lies in the range, from 0 at Min to 1 at Max (0 when Min equals Max).
Orientation 🠆
Orientation · Horizontal (the default) or Vertical. A vertical slider has Min at the bottom.
ScrollAreaSize 🠆
Vector2 · Read-only. ContentSize minus ViewSize: how far the content can scroll.
StyleOverride 🠆
SliderStyle · A style for this element only, applied over the general style. Setting it to null takes its values back out.
ThumbMargin 🠆
Margin · Moves the thumb across the track: it is centered in the slider’s thickness minus ThumbMargin.Top (horizontal) or ThumbMargin.Left (vertical). The other sides are not used.
ThumbMinSize 🠆
float · The smallest length of the thumb along the track, in units. It keeps a scroll bar’s thumb usable over long content. 10 unless set (DefaultSettings.DefaultSliderThumbMinSize).
ThumbScale 🠆
Vector2 · The thumb’s width (X) and height (Y) as a share of the slider’s thickness. On a scroll bar with ContentSize and ViewSize, the length along the track comes from them instead.
ThumbSolidColor 🠆
Color · The color of the thumb, without textures. (80, 80, 80) unless set (DefaultSettings.DefaultSliderThumbColor).
Tick 🠆
float · The step the value snaps to, from Min. 0 (the default) means no snapping and no tick marks.
TickOffset 🠆
int · The gap between the slider’s edge and the tick marks, in units. 2 unless set (DefaultSettings.DefaultSliderTickOffset).
TickPassedColor 🠆
Color · The color of the tick marks at or below the value. (86, 156, 214) unless set (DefaultSettings.DefaultSliderTickPassedColor).
TickPlacement 🠆
TickPlacement · Where the tick marks are drawn. None (the default) draws none.
TickRemainingColor 🠆
Color · The color of the tick marks above the value. (150, 150, 160) unless set (DefaultSettings.DefaultSliderTickRemainingColor).
TickSize 🠆
Point · The width and height of a tick mark, in units. 2 by 2 unless set (DefaultSettings.DefaultSliderTickSize).
Type 🠆
SliderType · The kind of slider: Slider (the default), SliderWithCaps, ScrollBar or ScrollBarNoButtons.
Value 🠆
float · The value, between Min and Max. A value you set is clamped to the range and snapped to the ticks.
ViewSize 🠆
Point · The size of the visible part of that content, in units. Changing it keeps the same content in view.
Methods
Slider() 🠆
Slider(string name = null) · Creates a slider. The name is used by GetElementByName.
| Parameter | Type | Description |
|---|---|---|
name |
string |
The element’s Name, which GetElementByName finds it by. Default: null. |
Draw() 🠆
Draw() · Draws the slider, then its tick marks. The framework calls it; you don’t need to.
PageDecrease() 🠆
PageDecrease() · Moves the value down by a page: one tick when Tick is set, otherwise the share of the range that ViewSize is of ContentSize - ViewSize. Does nothing when Type is Slider.
PageIncrease() 🠆
PageIncrease() · Moves the value up by a page, as PageDecrease moves it down. Does nothing when Type is Slider.
Events
OnValueChanged 🠆
(BaseElement sender, float value) · Value changes: by a drag, a click, from code, or when a new range, tick, ContentSize or ViewSize moves it. The value is already clamped and snapped.
| Parameter | Type | Description |
|---|---|---|
sender |
BaseElement |
The element that raised the event. |
value |
float |
The new value, already clamped and snapped. |