public sealed class Slider : IResponsive, IBundleAware
Standard slider UX object.

Constructors

Slider

#
Create a default slider from zero to one.
public Slider()

Slider

#
Create a slider initialised to a specific number.
public Slider(
number,
nonLinearity
)

Slider

#
Create a slider initialised to a specific number.
public Slider(
number
)

Properties

BackColour

#
Gets the sets the colour of the slider background. This will also affect the colour of the border, if any.
public Color BackColour { get; set; }

Bounds

#
Gets or sets the layout bounds for this slider.
public RectangleF Bounds { get; set; }

Bundle

#
Gets the bundle this slider is associated with.
public Bundle<Slider> Bundle { get; }

BundledSliders

#
Enumerate over all *other* sliders in the same bundle as this one.
public IEnumerable<Slider> BundledSliders { get; }

CornerRadius

#
Gets the corner radii of the grip. This depends solely on the grip type.
public float CornerRadius { get; }

CustomFormatting

#
Gets or sets a custom formatting delegate.
public Func<decimal, string> CustomFormatting { get; set; }

Font

#
Gets or sets the value format for the slider grip.
public Font Font { get; set; }

Format

#
Gets or sets the value format for the slider grip. The format supports several placeholders:

{0} will be replaced with the standard formatting.

{1} will be replaced with the standard percentile formatting.

{2} will be replaced with the actual value, and as such supports custom formatting hints.

{3} will be replaced with the normalised value, and as such supports custom formatting hints.

{4} will be replaced with the percentage value, and as such supports custom formatting hints.

{5} will be replaced with the non-linear value.

{6} will be replaced with the custom formatting string.

public string Format { get; set; }

GripColour

#
Gets the sets the colour of the slider grip.
public Color GripColour { get; set; }

GripDisplay

#
Gets or sets the grip display type.
public GripShape GripDisplay { get; set; }

Icon

#
Gets the icon (if any) associated with this slider.
public IIcon Icon { get; set; }

IconKey

#
Gets the icon state key associated with the slider value.
public string IconKey { get; set; }

Limits

#
Gets the limits and average value of this slider. Note, for the true values, access the Value property.
public UiNumber Limits { get; }

NonLinearity

#
Gets the non-linearity of this slider.
public NonLinearTicks NonLinearity { get; }

PresetCount

#
Gets the number of defined presets.
public int PresetCount { get; }

PresetNames

#
Enumerate over all preset names.
public IEnumerable<string> PresetNames { get; }

PresetRestrict

#
Gets or sets whether the slider is only allowed to exist at preset values.
public bool PresetRestrict { get; set; }

PresetValues

#
Enumerate over all preset values.
public IEnumerable<decimal> PresetValues { get; }

RailDisplay

#
Gets or sets the rail display type.
public SliderRailDisplay RailDisplay { get; set; }

Responder

#
Gets the UI response logic.
public Responses Responder { get; }
Responder

SlabThickness

#
Gets or sets the thickness of the grip. When left at its default (float.NaN) the value is derived from the grip type via SliderLayout.GripThickness / SliderLayout.LabelThickness. Callers that want the slab thickness to match a surrounding canvas shape can assign that thickness here prior to drawing.
public float SlabThickness { get; set; }

Values

#
Gets the value plurality for this slider.
public Plurality<decimal> Values { get; }

Methods

AddPreset

#
Add a preset by name and value.
public void AddPreset(
value,
Value of preset. May not exist yet as a preset.
name
Name of preset. May not be empty or whitespace.
)

AddPreset

#
Add a nameless preset by value.
public void AddPreset(
value
Value of preset. May not exist yet as a preset.
)

Draw

#
Render this slider into a context.
public void Draw(
context
Graphics context.
)

FormatValue

#
format a given value using the Format field. This is the text that the slider displays on the grip.
public string FormatValue(
value
Value to format.
)
Formatted value.

IsPreset

#
Gets whether a preset value has already been defined.
public bool IsPreset(
value
Value to search for.
)

IsPreset

#
Gets whether a preset name has already been defined. Name comparison is case sensitive.
public bool IsPreset(
name
Name to search for.
)

NearestPreset

#
Find the nearest preset.
public bool NearestPreset(
locus,
Search start.
out decimal
preset,
Nearest preset value.
out string
name
Nearest preset name.
)
True if preset was found.

NearestPreset

#
Find the nearest preset.
public bool NearestPreset(
locus,
Search start.
out decimal
preset
Nearest preset value.
)
True if preset was found.

NextPreset

#
Find the first preset strictly larger than the locus.
public bool NextPreset(
locus,
Search locus.
out decimal
preset,
Preset value.
out string
name
Preset name.
)
True if a previous preset was found.

NextPreset

#
Find the first preset strictly larger than the locus.
public bool NextPreset(
locus,
Search locus.
out decimal
preset
Preset value.
)
True if a previous preset was found.

PerformLayout

#
Perform layout for the current slider state.
public void PerformLayout()

PreviousPreset

#
Find the first preset strictly smaller than the locus.
public bool PreviousPreset(
locus,
Search locus.
out decimal
preset,
Preset value.
out string
name
Preset name.
)
True if a previous preset was found.

PreviousPreset

#
Find the first preset strictly smaller than the locus.
public bool PreviousPreset(
locus,
Search locus.
out decimal
preset
Preset value.
)
True if a previous preset was found.

RemovePreset

#
Remove a preset by value.
public bool RemovePreset(
value
Value of preset to remove.
)
True if preset was removed.

RemovePreset

#
Remove all presets with a given name.
public bool RemovePreset(
name
Name of preset to remove.
)
True if preset was removed.

RenderCustom

#
Render this slider into a graphics context, with optional overrides for various layers.
public void RenderCustom(
context,
Graphics context.
drawBack = null,
Optional background override.
drawRail = null,
Optional rail override.
drawGrip = null,
Optional grip override.
drawText = null,
Optional text override.
drawPopup = null
Optional popup override.
)

RenderStandardBack

#
Default background render method.
public static void RenderStandardBack(
context,
Graphics context.
slider
Slider to render.
)

RenderStandardGrip

#
Default grip render method.
public static void RenderStandardGrip(
context,
Graphics context.
slider
Slider to render.
)

RenderStandardPopup

#
Default numeric popup render method.
public static void RenderStandardPopup(
context,
Graphics context.
slider
Slider to render.
)

RenderStandardRail

#
Default rail render method.
public static void RenderStandardRail(
context,
Graphics context.
slider
Slider to render.
)

RenderStandardText

#
Default rail render method.
public static void RenderStandardText(
context,
Graphics context.
slider
Slider to render.
)

SetLimits

#
Set new limits and value of this slider.
public void SetLimits(
number
New number.
)

SnapToPreset

#
Snap a value to the nearest preset in range.
public bool SnapToPreset(
locus,
Value to snap.
out decimal
result
Snapped value, or original value if no snapping occured.
)
True if value was snapped.

Events

SliderDisplayChanged

#
This event is raised whenever the slider state, but not the value changes.
public event EventHandler<SliderEventArgs> SliderDisplayChanged

SliderValueChanged

#
This event is raised whenever the slider value changes.
public event EventHandler<SliderEventArgs> SliderValueChanged