Hello,
Here is a workaround that can get the correct CultureInfo.
- Use GlobalizationPreferences.Languages to get current Language setting and convert it to
CultureInfo
. - Use Windows.Globalization.NumberFormatting.DecimalFormatter to convert the number to the correct format.
var cultureInfo= new System.Globalization.CultureInfo(Windows.System.UserProfile.GlobalizationPreferences.Languages[0]);
var valueToBeFormatted = 1234567891.23;
string currentLanguage= cultureInfo.Name;
string currentRegion = Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion;
// In this case it's the Euro with the default number formatting for Germany.
var DecimalFormatEuroDE = new Windows.Globalization.NumberFormatting.DecimalFormatter(new[] { currentLanguage }, currentRegion);
DecimalFormatEuroDE.IsGrouped = true;
var DecimalValueEuroDE = DecimalFormatEuroDE.Format(valueToBeFormatted);
// Results for display.
var results = "Fixed number (" + valueToBeFormatted + ")\n" +
"Formatted Euro (de-DE defaults): " + DecimalValueEuroDE;
Debug.WriteLine(results);
Thank you
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.