Skip to content

Commit

Permalink
Merge pull request #2942 from telerik/new-kb-kb-calculator-recognize-…
Browse files Browse the repository at this point in the history
…period-comma-decimal-3900bed54a654c7081e81e58cb8bc166

Added new kb article kb-calculator-recognize-period-comma-decimal
  • Loading branch information
martinivanoff authored Aug 13, 2024
2 parents 8aed574 + 42578a3 commit ee93b85
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions knowledge-base/kb-calculator-recognize-period-comma-decimal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Making RadCalculatorPicker Recognize Period or Comma Key as Decimal
description: Learn how to configure the RadCalculatorPicker in WPF to recognize the period or comma key as a decimal separator.
type: how-to
page_title: Configuring RadCalculatorPicker to Accept Period or Comma as Decimal Separator in WPF
slug: kb-calculator-recognize-period-comma-decimal
tags: radcalculator, wpf, keydown, decimal separator
res_type: kb
ticketid: 1642565
---

## 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.

#### __[C#]__
{{region kb-calculator-recognize-period-comma-decimal-0}}
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);
}
}
{{endregion}}

0 comments on commit ee93b85

Please sign in to comment.