Skip to main content
Version: 11.0.x

NumericUpDown

The NumericUpDown is an editable numeric input with up and down spinner buttons attached. Non-numeric characters are ignored in the input. The value can also be changed by clicking the buttons, or by using the keyboard arrow keys. The mouse wheel (if present) will also change the value.

Useful Properties

You will probably use these properties most often:

PropertyDescription
ValueThe value (decimal?).
IncrementThe increment used by the button spinner, keyboard and mouse wheel. Default increment is 1.
MinimumThe minimum value allowed.
MaximumThe maximum value allowed.
FormatStringThe format string for the numerical value. This is important if you are setting a custom increment.
ButtonSpinnerLocationThe location of the spinner buttons. Choose from left and right (default).
AllowSpinDetermines if incrementing and decrementing using the spinner buttons, keyboard and mouse wheel is active. Default is true.
ShowButtonSpinnerDetermines whether the spinner buttons are shown. Default is true.

Examples

This is a basic example of a numeric up-down control. There are no limits to the value here:

<StackPanel Margin="20">
<TextBlock Margin="0 5">Number of items:</TextBlock>
<NumericUpDown Value="10" />
</StackPanel>

The value and other properties are nullable decimals; so you can create a custom decimal increment/decrement and range if you need to.

info

Remember to specify a FormatString property when you create a custom decimal increment and range.

For example:

<StackPanel Margin="20">  
<TextBlock Margin="0 5">Opacity:</TextBlock>
<NumericUpDown Value="0.5" Increment="0.05"
FormatString="0.00"
Minimum="0" Maximum="1"/>
</StackPanel>

More Information

info

For the complete API documentation about this control, see here.

info

View the source code on GitHub NumericUpDown.cs