How do you localize the DatePicker and the TimePicker?
Our use case is that the user will set the language in the control panel and we will try to display the correct datepicker/timepicker format.
I tried setting the DatePicker/TimePicker Language property but it still is set to English and the order is still in english format (Month date year) for Date Picker and (Hour minutes AM/PM) for timepicker.
I did try the DatePicker.CalendarIdentifier and it did change the date format of the datepicker. So for a Japanese language, it was correctly set, but the timepicker only has a clockidentifier, so it did not change the display (AM/PM is still in english).
Does it mean that I have to identify the language and set the calendaridentifer/clockidentifier manually?
Thanks in advance!
UPDATE: I did found out about the GlobalizationPreference and I could set it to the Date and TimePicker:
var calendar = Windows.System.UserProfile.GlobalizationPreferences.Calendars[0]; var clock = Windows.System.UserProfile.GlobalizationPreferences.Clocks[0];
If I set the region settings to Japanese, the clock is correctly set to 24HourClock. But the calendar is still set to GregorianCalendar.
Is this a bug or there is a different way to set the calendar so that I could retrieve correctly the GlobalizationPreferences.Calendar?
I was able to fix my issue on this one.
Somehow, although I have already set the regional settings and language settings in the control panel (example: japanese), the datepicker.Language and timepicker.Language still uses the Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride that was set. Eventhough I set the language in the control (datepicker and timepicker) to japanese.
So what I did is that, in the startup of the application, app.xaml.cs, I set the Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride this to an empty string and now it follows the setting I set in the language settings and region settings.