Closed hyperquantum closed 9 months ago
This is a limitation in the underlying control. It might be possible to come up with a solution using the callback fields in the format string. If we could come up with a solution using that we'd probably want to add a new API to allow specifying the desired localization behavior. Not a trivial amount of work.
Some other links:
https://stackoverflow.com/questions/8141437/change-datetimepicker-calendar-runtime https://stackoverflow.com/questions/40439469/date-time-picker-culture-info-in-window-forms?rq=1 https://web.archive.org/web/20110717083209/http://blogs.msdn.com/b/michkap/archive/2005/03/28/402839.aspx https://web.archive.org/web/20110718101517/http://support.microsoft.com/kb/889834
@merriemcgaw Was this fixed in the underlying control? Or what was the fix exactly?
I should have marked this as not planned, my mistake. No, we can't make changes to the underlying Common Control unfortunately, so @JeremyKuhne provided ideas for options. Windows does not make changes to the Common controls due to high regression risk and compatibility requirements. As a managed wrapper around Win32 and Common Controls we are limited as to what we can change.
.NET Core Version: 3.1
Have you experienced this same bug with .NET Framework?: Yes
Problem description:
It is not currently possible to change the language used by DateTimePicker. The control ignores CurrentCulture/CurrentUICulture of the current thread and uses the language as configured by the operating system.
This problem is an issue for WinForms applications that are localized in different languages and that need to be able to run with a language that is different from the language of the operating system.
This problem is (or was) also known as KB 889834.
Expected behavior:
DateTimePicker adapts to the CurrentCulture/CurrentUICulture of the current thread.
Minimal repro:
Create a new WinForms project.
Change Program.cs as follows (add the 3 lines about culture):
In the form designer, add a Label and a DateTimePicker to the form.
Initialize the label text in the form's constructor:
For me, running this program results in:
The DateTimePicker should use the same language as the Label but it doesn't.