NumberPicker

Numeric input with arrow key increment/decrement and direct digit entry.

Overview

NumberPicker extends Control and provides a focused numeric input for selecting a value within a defined range. The control displays the current value with optional left/right arrow indicators. Users can adjust the value using arrow keys for fine-grained increment/decrement, Page Up/Down for larger jumps, or type digits directly for rapid entry. The value is always clamped between Minimum and Maximum. DecimalPlaces and FormatString control how the number is rendered, making it suitable for both integer counters and decimal inputs like percentages or currencies.

Basic Example

<StackPanel Orientation="Vertical">
  <TextBlock Text="Select quantity:" />
  <NumberPicker Value="1" Minimum="1" Maximum="99" Increment="1" />
</StackPanel>

Properties

PropertyTypeDefaultDescription
Valuedouble0The current numeric value of the picker.
Minimumdouble0The smallest allowed value. The control clamps input to this floor.
Maximumdouble100The largest allowed value. The control clamps input to this ceiling.
Incrementdouble1The amount added or subtracted per arrow key press.
DecimalPlacesint0Number of decimal digits displayed. Use 0 for integer-only input.
FormatStringstring?nullOptional .NET format string (e.g. "C2", "P0"). Overrides DecimalPlaces when set.
WidthSizeAutoExplicit width of the control.
HeightSizeAutoExplicit height of the control.
FocusColorColorCyanBorder color when the control has keyboard focus.
HoverColorColorYellowBorder color when the mouse hovers over the control.

Examples

Integer Picker

<StackPanel Orientation="Vertical">
  <TextBlock Text="Items in cart:" />
  <NumberPicker Value="1"
                Minimum="1"
                Maximum="50"
                Increment="1"
                DecimalPlaces="0" />
</StackPanel>

Decimal Picker

<StackPanel Orientation="Vertical">
  <TextBlock Text="Temperature (&deg;C):" />
  <NumberPicker Value="36.5"
                Minimum="30.0"
                Maximum="45.0"
                Increment="0.1"
                DecimalPlaces="1" />
</StackPanel>

Large Range with Step 100

<StackPanel Orientation="Vertical">
  <TextBlock Text="Budget ($):" />
  <NumberPicker Value="1000"
                Minimum="0"
                Maximum="100000"
                Increment="100"
                DecimalPlaces="0"
                FocusColor="Green" />
</StackPanel>

Keyboard Shortcuts

KeyAction
Up ArrowIncrement the value by Increment.
Right ArrowIncrement the value by Increment.
Down ArrowDecrement the value by Increment.
Left ArrowDecrement the value by Increment.
Page UpIncrement the value by 10 × Increment.
Page DownDecrement the value by 10 × Increment.
HomeSet the value to Minimum.
EndSet the value to Maximum.
0–9Direct digit entry — appends to the current input buffer.
BackspaceDelete the last entered digit from the input buffer.
EnterCommit the typed digit sequence and clamp to the allowed range.

Key Concepts