Bug 36417 - Built-in conversion of string to double values does not take current culture into account
Summary: Built-in conversion of string to double values does not take current culture ...
Status: RESOLVED FEATURE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 52319 ()
Depends on:
Blocks:
 
Reported: 2015-12-01 12:38 UTC by René
Modified: 2017-03-24 17:45 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description René 2015-12-01 12:38:49 UTC
This report has also been reported as an issue on Github: https://github.com/xamarin/Duplo/issues/3527

When using bindings (Entry to double property) I noticed that the current culture setting is not applied. Example on a German iPhone with German locale: entering „42,3“ results in „423“. Using „42.3“ instead works. I can now work around by using a string property (which will cause other side effects, like INPC being triggered if for instance "42" is changed to "42,") but I was wondering if this has been forgotten or is working as intended?

An example project can be seen here: https://github.com/Krumelur/XamarinForms_SliderTest/blob/master/SliderTest/TestPage.xaml#L4

Note: as mentioned this is a problem if the decimal separator is not ".", so switch iOS to German locale.

Comment from Stephane on Slack about the problem:

"I have to check the rationale, but I think the built-in conversion for bindings (ToString() and Parse()) use invariantCulture, so you can bind to/from value you get, e.g., from a json on your backend(edited) we had that discussion before, your use case is a good one."
Comment 1 Jason Smith [MSFT] 2016-04-13 20:03:25 UTC
This is expected behavior. All binding conversions assume invariant culture.
Comment 2 Jimmy [MSFT] 2017-03-24 17:45:25 UTC
*** Bug 52319 has been marked as a duplicate of this bug. ***