Перейти к основному содержимому
Версия: 11.0.0

Numeric Up-Down

The numeric up-down 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:

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.


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" />

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

к сведению

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"
Minimum="0" Maximum="1"/>

More Information

к сведению

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

к сведению

View the source code on GitHub NumericUpDown.cs