WPF Toolkit, How to apply date format in C# for datepicker control?

独自空忆成欢 提交于 2019-12-04 03:47:55

问题


WPF Toolkit, How to apply date format in C# for datepicker control?


回答1:


I found the one way to solve of my problem by using the culture

System.Globalization.CultureInfo culInfo = new System.Globalization.CultureInfo("en-us");

System.Globalization.DateTimeFormatInfo dtinfo = new System.Globalization.DateTimeFormatInfo();

dtinfo.ShortDatePattern = "dd-Mon-yyyy";

dtinfo.DateSeparator = "-";

And apply this short date pattern to date time picker.. It works




回答2:


The datepicker in WPF Toolkit allow only Short and Long formats. You can use as

datePicker.SelectedDateFormat = Microsoft.Windows.Controls.DatePickerFormat.Long;
datePicker.SelectedDateFormat = Microsoft.Windows.Controls.DatePickerFormat.Short;



回答3:


If you change format following this way. All control have DateTime will be change. I think you need create new template and create new you custom control



来源:https://stackoverflow.com/questions/1378484/wpf-toolkit-how-to-apply-date-format-in-c-sharp-for-datepicker-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!