Skip to content

NumericUpDown class

A numeric input with step buttons and in-place text editing of a value within a range.

Guide: C# Markup reference: Input

public sealed class NumericUpDown : RangeBase
name description
NumericUpDown() The default constructor.
ChangeOnWheel { get; set; } Gets or sets whether the mouse wheel changes the value by SmallChange per notch while the pointer is over the box.
DisplayText { get; } Gets the formatted value text shown while not editing.
Format { get; set; } Gets or sets the format string the value is displayed with.
IsEditing { get; } True while the user (or programmatic call) is editing the value via the inline TextBox. Use BeginEdit, CommitEdit, CancelEdit to control.
IsInteger { get; set; } Gets or sets whether Value is rounded to the nearest whole number on every assignment and each step is a whole number of at least 1; the default is false.
BeginEdit() Enters edit mode: shows the TextBox, focuses it and selects all text. No-op if already editing, the control is disabled, or no editable TextBox part is attached.
CancelEdit() Exits edit mode without committing the TextBox text. The displayed value is restored.
CommitEdit() Parses the TextBox text into Value and exits edit mode. If the text cannot be parsed, the displayed value is restored.
StepDown() Decreases the value by SmallChange.
StepUp() Increases the value by SmallChange.
static readonly ChangeOnWheelProperty
static readonly DisplayTextProperty
static readonly FormatProperty
static readonly IsEditingProperty
static readonly IsIntegerProperty
const PART_TEXT_BOX Template part name for the editable text box; register a TextBox under this name to receive the edit pipeline.