CalculatorUpDown

The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.

calculatorupdown.jpg

When using the CalculatorUpDown in data binding scenarios, bind your object's value to the Value property. You can specify how much to increment the value by setting the Increment property. You can control the minimum and maximum allowed values by setting the Minimum and the Maximum properties. You can also specify if the user can directly edit the values in the text box by setting the IsEditable property. If you would like to get the actual fromatted string representation of the value, you can use the Text property.

Applying FormatStrings

Default:
calculatorupdown_default.jpg
     <xctk:CalculatorUpDown Value="1564.6749586" />


Floating Point:
calculatorupdown_float.jpg
     <xctk:CalculatorUpDown FormatString="F3" Value="1564.6749586" Increment=".001"  Maximum="200000.599" />


Currency:
calculatorupdown_currency.jpg
     <xctk:CalculatorUpDown FormatString="C2" Value="1564.6749586" Increment=".5" Maximum="5000.50" Minimum="50.01" />


Supported Format Strings

Format Specifier Name
C Currency
F Fixed Point
G General
N Number
P Percent


Watermark

You can provide a Watermark to show text in place of a NULL Value.

calculatorupdown_watermark.jpg
     <xctk:CalculatorUpDown Watermark="Enter Value" />


Properties / Events

Property Description
AllowSpin Gets/Sets the ability to perform increment/decrement operations via the keyboard, button spinners, or mouse wheel.
CultureInfo Gets/Sets the current CultureInfo.
DefaultValue Get/Sets the value to use when the Value is null and an increment/decrement operation is performed.
DisplayText Gets/Sets the text displayed in the Calculator view port.
EnterClosesCalculator Gets/Sets whether or not the Enter keyboard button will close the Calculator when pressed.
FormatString Gets/Sets the dispaly format of the Value.
Increment Specifies the amount in which to increment the value.
IsEditable Determines if direct entry is allowed in the text box.
Maximum Gets/Sets the maximum allowed value.
Memory Gets/Sets the numeric value stored in the Calculator memory.
Mimum Gets/Sets the minimum allowed value.
Precision Gets/Sets the maximum number of digits displayed to the right of the decimal point in the Calculator.
SelectAllOnGotFocus If set to true, all text is selected when control gets focus.
ShowButtonSpinner Gets/Sets if the button spinners are visible.
Text Gets/Sets the formated string representation of the value.
TextAlignment Gets/Sets the alignment of the Text
Value Gets/Sets the numeric value.
Watermark Gets/Sets the object to use as a watermark if the Value is null.
WatermarkTemplate Gets/Sets the DatTemplate to use for the Watermark.


Event Description
ValueChanged Occurs when the Value changes.


Support this project, check out the Plus Edition.
---

Last edited May 9, 2013 at 8:44 PM by Kosmatos, version 9

Comments

BoucherS Feb 7 at 12:27 PM 
Hi,
Please use a Discussion tab.
Setting CalculatorUpDown.Visibility = Collapsed works well. Can you point out the fixed width and height ?

vdohnal Feb 7 at 8:43 AM 
This control sets fixed width and height of its parts and it does not work well with Visibility.Collapsed.

pcttechnical Jun 3, 2012 at 11:33 PM 
Cool tool. But is there any way to make data entry more consistent with a textbox regarding binding updates? In particular a binding like this :

Value="{Binding Path=MyProperty, UpdateSourceTrigger=PropertyChanged}"

*does not* cause the binding to be updated immediately when the value in the control is updated by keyboard input as one would expect....