Jaswant Agarwal
Jaswant Agarwal

Reputation: 4905

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

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

Upvotes: 4

Views: 10880

Answers (3)

Jaswant Agarwal
Jaswant Agarwal

Reputation: 4905

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

Upvotes: 6

Hieu.Nguyen
Hieu.Nguyen

Reputation: 1

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

Upvotes: -2

Sauron
Sauron

Reputation: 16903

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;

Upvotes: 0

Related Questions