Extended WPF Toolkit™ Community Edition DecimalUpDown
The free Community Edition of the Exceed DecimalUpDown provides a textbox with up and down arrows to allow incrementing numeric values up or down by a value of 1.
WPF Composites also provides two
additional methods to make working with the DecimalUpDown control easier.
The first is a method called AddNumericTextBox
that you may call within BeginComposite . . . EndComposite. It lets you define decimal values including: min value, max value, starting value, and increment value. You may also choose whether to select all
text when focus is set on the control. Lastly, you may enter a format string as follows:
//Currency with 2 decimal places
.AddNumericTextBox<Grid>(9, 3, 139D, 23D, 299.99M, 999.99M, 0.00M, 1.00M, "C2", true)
//Percent with 2 decimal places
.AddNumericTextBox<ContentControl3D>(7, 1, 139D, 23D, .99M, 1.00M, 0.00M, .010M, "P2", true)
The second is a method called GetValueFromNumericTextBox
which lets you retrieve the current value from the DecimalUpDown control as a Nullable decimal.
//get nullable decimal value from DecimalUpDown control at row-column 9-3 in Composite (Border)
decimal? myDecimal = thisComposite.GetValueFromNumericTextBox<Grid>(9, 3);