NumericUpDown class Core

A number field with up and down buttons, the free-standing form of a grid's number editor: typed and shown in a culture's format, read back with the number column's rules (TypedColumn.Number: "1234.5" in a German field is 1234.5, never 12345), kept between NumericUpDown.Minimum and NumericUpDown.Maximum. The arrows and the wheel (while it holds the keyboard; fractions of a touchpad add up to a step) move it by NumericUpDown.Step onto its multiples, Page Up/Down by NumericUpDown.LargeStep, Ctrl+Home and Ctrl+End to the ends (Home and End move the caret, as in any field); holding a button repeats while the pointer stays on it. Tabbing through the field changes nothing: its own text is read back as the value it shows, so a value is never rounded to the format or cut at a thousands separator. An optional NumericUpDown.Mask types through the cell editor's input mask. Like ArionSlider it holds no value of its own: NumericUpDown.Value reads it and NumericUpDown.Changed hands a new one over.

Typed text is taken on Enter or when the keyboard leaves; a text that is no number keeps the field TileStates.Invalid with the number column's message until it is corrected or Escape restores the value.

Styling. From the style sheets (Select.Type<NumericUpDown>()): background, border colour and width, corner radius, accent (caret), text and opacity, in the states hover, focus, disabled and invalid.

A screen reader reads it as a spin button with a value and a range, and may set either.

public sealed class NumericUpDown : Control
Namespace
ArionUI.Presentation.Controls
Package
ArionUI.Presentation · dotnet add package ArionUI.Presentation --prerelease
Inherits
Control

Constructors

NumericUpDown

public NumericUpDown();

A field in the theme's body text.

Properties

AccessibleRange

public override AccessibleRange? AccessibleRange { get; }

The range of a part that picks a value along one (a slider); null otherwise.

AccessibleValue

public override string? AccessibleValue { get; }

The text of a text part; null when the part carries no value.

CaretRect

public override LogRect? CaretRect { get; }

Where the caret of a text sink stands, absolute like Control.Bounds and as last drawn; null for a control without a caret or before it was drawn. The host anchors the input method's candidate window here.

Changed

public required Action<double> Changed { get; init; }

Called with the new value when the user changes it (never with the value it already has); store it where NumericUpDown.Value reads it.

Culture

public CultureInfo? Culture { get; init; }

The culture of the format and of reading typed text; null takes the grid's (or the thread's) culture when it is used.

Cursor

public override GridCursor Cursor { get; }

The pointer shape over this control: the arrow (GridCursor.Default) over buttons, options, tabs and everything else that is clicked, the I-beam (GridCursor.Text) over text that can be typed in, the hand only over a link - the Windows rule. A control with parts of different shapes answers Control.CursorAt.

DrawsOwnFocus

public override bool DrawsOwnFocus { get; }

The control shows its focus itself (accent border, hover row, ring parameter). False = the host draws the shared default ring around Control.Bounds.

Focusable

public override bool Focusable { get; }

Can this KIND of control hold the keyboard focus? Combined with the live probes in Control.CanTakeFocus.

Format

public string Format { get; init; }

The .NET format the value is shown and typed in ("0.##", "N2").

Height

public double Height { get; init; }

Desired height; the width is whatever it is given.

LargeStep

public double LargeStep { get; init; }

What Page Up and Page Down move; 0 (the default) takes ten steps.

Mask

public string? Mask { get; init; }

An input mask (the cell editor's: 0 a digit, 9 an optional one, other characters literal); null types freely.

Maximum

public double Maximum { get; init; }

The highest value.

Minimum

public double Minimum { get; init; }

The lowest value.

Role

public override ControlRole Role { get; }

What KIND of part this is for assistive technology — the automation peers translate it into their host's control type.

Spoken

public Func<string>? Spoken { get; init; }

The field's name for a screen reader ("Quantity").

Step

public double Step { get; init; }

What an arrow, a wheel notch or a button press moves; a step lands on a multiple of it, counted from NumericUpDown.Minimum. Must be greater than 0.

Text

public string Text { get; }

The text as the field shows it now: what is typed, or the value.

Value

public required Func<double> Value { get; init; }

The current value, asked each time it is drawn.

WantsText

public override bool WantsText { get; }

Is this control a text sink? The host routes typing to the focused text control, or — the Excel rule — jumps to the FIRST one in the tree.

WantsTick

public override bool WantsTick { get; }

The control animates and wants Control.Tick on every frame.

Methods

CursorAt

public override GridCursor CursorAt(LogPoint p);

The I-beam over the number, the arrow over the spin buttons (and the mark of an invalid value).

Measure

public override LogSize Measure(LogSize available);

Desired size given the space available (layout containers sum this).

OnFocusChanged

public override void OnFocusChanged();

Focus arrived at or left this control (read Control.IsFocused). For side effects the host cannot know — a list syncing its hover row.

OnKey

public override bool OnKey(ArionKey key, ArionModifiers mods);

Keys while focused. Return false to let the pane's fallback see the key.

OnPointerLeft

public override void OnPointerLeft();

The pointer stopped hovering this control (moved on or left the pane).

OnPointerMoved

public override void OnPointerMoved(LogPoint p, bool buttonDown);

OnPointerPressed

public override void OnPointerPressed(LogPoint p, ArionModifiers mods, int clickCount);

OnPointerReleased

public override void OnPointerReleased(LogPoint p);

OnText

public override void OnText(string text);

OnWheel

public override bool OnWheel(LogPoint p, double delta);

The wheel steps the value while the field holds the keyboard; over a field that does not, it scrolls the page.

Render

public override void Render(IRenderSurface s, ControlFrame frame);

SetAccessibleRangeValue

public override bool SetAccessibleRangeValue(double value);

Set the value of a range part, as the user could. False when the part has no range or is disabled.

SetAccessibleValue

public override bool SetAccessibleValue(string value);

Sets the value a screen reader typed, read as typed text is. False when disabled or not a number.

SpokenLabel

public override string? SpokenLabel();

What a screen reader speaks when this control receives the focus. A control that cannot take the focus but answers here is READ: it becomes a text part.

Tick

public override void Tick(double dtMs);

One frame of the animation. What it changes on screen it marks itself (Control.Invalidate): on a board only the marked area is drawn again.