You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
in the sample application, when I select the Persian culture and input a decimal number such as 12.751, the input number changes to 12.000 when I leave the control.
I debugged it and realize that in Persian culture, NumberDecimalSeparator property sets to '/'. and the number: 12.751 informed to 12/751. So the TryGetNumberFromText() method cannot get the full part of that as a number and returns 12 instead of 12.751
So I fix this issue by changing the code below in the ValidateText method inside of NumbericUpDown class:
//var number = TryGetNumberFromText(text, isHex);
var number = TryGetNumberFromText(text.Replace(this.SpecificCultureInfo.NumberFormat.NumberDecimalSeparator, "."), isHex);
number = number.Replace(".", this.SpecificCultureInfo.NumberFormat.NumberDecimalSeparator);
I just want you to commit that part of the code in the main project and release a new branch into NuGet. thank you.
The text was updated successfully, but these errors were encountered:
…ersian culture
We need to use a dynamic Regex for the number input instead a static one. So we must look for the NumberFormat.NumberDecimalSeparator and NumberFormat.NumberGroupSeparator and build a new Regex if the Culture was changed.
ClosesMahApps#3665
Describe the bug
in the sample application, when I select the Persian culture and input a decimal number such as 12.751, the input number changes to 12.000 when I leave the control.
I debugged it and realize that in Persian culture, NumberDecimalSeparator property sets to '/'. and the number: 12.751 informed to 12/751. So the TryGetNumberFromText() method cannot get the full part of that as a number and returns 12 instead of 12.751
So I fix this issue by changing the code below in the ValidateText method inside of NumbericUpDown class:
//var number = TryGetNumberFromText(text, isHex);
var number = TryGetNumberFromText(text.Replace(this.SpecificCultureInfo.NumberFormat.NumberDecimalSeparator, "."), isHex);
number = number.Replace(".", this.SpecificCultureInfo.NumberFormat.NumberDecimalSeparator);
I just want you to commit that part of the code in the main project and release a new branch into NuGet. thank you.
The text was updated successfully, but these errors were encountered: