Currently we're parsing Key.Decimal the same way we're parsing Key.OemPeriod. Our clients want to always type the culture decimal separator when pressing the Numpad separator key (del). Currently if the client uses a French culture, which decimal separator is comma - pressing the Numpad separator key does nothing. Workaround: Handling the RadNumericUpDown.PreviewKeyDown method: private void RadNumericUpDown_PreviewKeyDown(object sender, KeyEventArgs e) { var num = sender as RadNumericUpDown; if (e.Key == Key.Decimal || e.Key == Key.OemComma || e.Key == Key.OemPeriod) { var textBox = e.OriginalSource as System.Windows.Controls.TextBox; if (!textBox.Text.Contains(num.NumberDecimalSeparator)) { textBox.Text += num.NumberDecimalSeparator; textBox.CaretIndex = textBox.Text.Length; } e.Handled = true; } }
As a workaround you can change the NumberNegativePattern to the default one like so: System.Globalization.CultureInfo ci = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); ci.NumberFormat.NumberNegativePattern = 1; Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci;
Currently, the control doesn't allow to paste numeric strings with leading and trailing white spaces. For example " 35 ".
To achieve this, you can subscribe the RadNumericUpDown control to the Pasting event and implement the pasting manually.
DataObject.AddPastingHandler(this.numericUpDown, OnNumericUpDownPaste);
private void OnNumericUpDownPaste(object sender, DataObjectPastingEventArgs e)
{
var copiedString = e.DataObject.GetData(typeof(string)) as string;
if (copiedString != null)
{
copiedString = copiedString.Trim();
double number = 0;
var success = double.TryParse(copiedString, out number);
if (success)
{
this.numericUpDown.SetCurrentValue(RadNumericUpDown.ValueProperty, number);
e.CancelCommand();
}
}
}