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

后端 未结 3 418
离开以前
离开以前 2021-01-20 00:07

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

相关标签:
3条回答
  • 2021-01-20 01:06

    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;
    
    0 讨论(0)
  • 2021-01-20 01:08

    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

    0 讨论(0)
  • 2021-01-20 01:09

    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

    0 讨论(0)
提交回复
热议问题