Making RadCalculatorPicker Recognize Period or Comma Key as Decimal
Environment
Product | Version |
---|---|
RadCalculator for WPF | Current |
Description
When using the RadCalculatorPicker on a device without a numeric keypad, the decimal key does not work as expected. This article demonstrates how to make RadCalculatorPicker recognize the period or comma key as a decimal separator.
Solution
To make RadCalculatorPicker recognize the period (.) or comma (,) key as the decimal separator, subscribe to the KeyDown
event and execute the RadCalculatorCommands.UpdateInput
command.
private void RadCalculatorPicker_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == System.Windows.Input.Key.OemPeriod)
{
RadCalculatorCommands.UpdateInput.Execute(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
}
}