NumberPicker

References
public sealed class NumberPicker : IResponsive
Standard numberline picker UX object. The picked value is always the number underneath a fixed marker line in the horizontal centre of the control. The numberline itself is dragged and zoomed underneath that marker.

Constructors

NumberPicker

#
public NumberPicker()
Create a default number picker.

NumberPicker

#
public NumberPicker(decimal number, decimal scale)
Create a number picker based on an initial value and zoom.
number (decimal)Initial value.
scale (decimal)Zoom, expressed as numberline units per pixel.

NumberPicker

#
public NumberPicker(decimal number)
Create a number picker based on an initial value.
number (decimal)

NumberPicker

#
public NumberPicker(UiNumber initial)
Create a number picker initialised to a specific number. The number specifies the zoom and value, the lower and upper limits define the range of numbers that can be picked.
initial (UiNumber)

Properties

BackColour

#
public Color BackColour { get; set; }
Gets or sets the colour of the picker background.

Bounds

#
public RectangleF Bounds { get; set; }
Gets or sets the layout bounds for this picker. Resizing retains the zoom, not the visible limits.

Centre

#
public decimal Centre { get; set; }
Gets or sets the exact number underneath the marker line. Unlike Value this number is never rounded.

Limits

#
public UiNumber Limits { get; }
Gets the limits for this picker. The limits define the lowest and highest allowed values. The value of the UiNumber represents the original value.

LineColour

#
public Color LineColour { get; set; }
Gets or sets the colour of the marker line.

Quantum

#
public decimal Quantum { get; }
Gets the distance between the smallest visible ticks. This is the quantum the value is rounded to when snapping.

Responder

#
public Responses Responder { get; }
Responder

Scale

#
public decimal Scale { get; set; }
Gets or sets the zoom of the numberline, expressed as numberline units per pixel.

ShowBalloon

#
public bool ShowBalloon { get; set; }
Gets or sets whether a value balloon is drawn above the marker line while the cursor hovers over the picker or the numberline is navigated.

SnapToTicks

#
public bool SnapToTicks { get; set; }
Gets or sets whether the value is rounded to the visible tick density.

TickExponent

#
public int TickExponent { get; }
Gets the power-of-ten exponent of the smallest visible tick class.

Value

#
public decimal Value { get; }
Gets the picked value. This is the number underneath the marker line, rounded to the visible tick density when SnapToTicks is on.

Methods

Draw

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

DrawBalloon

#
public void DrawBalloon(Context context, Color fill)
Render the value balloon above the marker line. The balloon sticks out above the bounds, so this must be called without a clipping region in place.
context (Context)Graphics context.
fill (Color)Solid balloon colour, the text is drawn in a contrasting colour.

FormatValue

#
public static string FormatValue(decimal value, int exponent)
Write a number to the decimals of a tick class.
value (decimal)Number to format.
exponent (int)Power-of-ten exponent of the tick class.
Formatted number.

FormatValue

#
public string FormatValue(decimal value)
Write a number the way the balloon would show it at the current zoom. With snapping on the decimals follow the finest visible tick class, without it the number is written out in full.
value (decimal)Number to format.
Formatted number.

QuantumFor

#
public static decimal QuantumFor(decimal scale)
Compute the distance between the smallest ticks visible at a zoom.
scale (decimal)Zoom, expressed as numberline units per pixel.
Quantum at that zoom.

SetValue

#
public void SetValue(decimal value)
Assign a value. The numberline is recentred exactly on the new value, the zoom is retained.
value (decimal)New value.

SnapBack

#
public void SnapBack()
Recentre the numberline exactly on the current value. The motion is animated, the value itself does not change.

SnapBackWhenIdle

#
public void SnapBackWhenIdle()
Snap back once navigation has been quiet for a moment. Used by navigation paths which have no explicit end signal.

TickExponentFor

#
public static int TickExponentFor(decimal scale)
Compute the power-of-ten exponent of the smallest tick class visible at a zoom.
scale (decimal)Zoom, expressed as numberline units per pixel.
Exponent of the finest visible tick class.

Zoom

#
public static decimal Zoom(decimal scale, float dy)
Compute a zoomed scale from a base scale and a vertical mouse motion. Uses the same convention as Movement zooming, a downward motion of fifty pixels doubles the scale.
scale (decimal)Base scale.
dy (float)Vertical mouse motion in pixels.
Zoomed scale.

Events

PickerDisplayChanged

#
public event EventHandler<NumberPickerEventArgs> PickerDisplayChanged
This event is raised whenever the picker state, but not the value changes.

PickerValueChanged

#
public event EventHandler<NumberPickerEventArgs> PickerValueChanged
This event is raised whenever the picker value changes.