Fix CultureInfo issue in UpDown variants #3860
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3858
This ensures that
CultureInfo.CurrentCultureis used in the string conversions of theValueproperty throughout the control. This allows the control to be used in cultures that do not use a "dot" as the decimal separator (like danishda-DKfor example).Tests
I left a comment on the issue, because I wanted to write some UI tests for this, but I believe I am missing an API hook in XAMLTest that will allow me to inject a culture for the WPF app that is spun up. Feature request 😛
NOTE: The previous implementation was using
CultureInfo.CurrentUICulturewhich I don't believe was correct. To my knowledge (and please correct me if I am wrong), the "UI" variant is newer property primarily used for translations of strings, whereasCultureInfo.CurrentCultureshould be used for number formatting etc.It is not uncommon for people like myself (at least in the dev world) to want to use their own local numbering scheme (thus
CultureInfo.CurrentCulture=da-DKin my case), but still want UI strings to be in English (thusCultureInfo.CurrentUICulture=en-USin my case).