4

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

4
  • Take a look at http://windowsclient.net/wpf/wpf35/wpf-35sp1-toolkit-calendar-datepicker-walkthrough.aspx Commented Sep 4, 2009 at 10:50
  • Specify more information. What format you need? Commented Sep 4, 2009 at 10:52
  • Required is dd-mon-yyyy to selected date format.. Commented Sep 4, 2009 at 11:59
  • In wpftoolkit 4: <toolKit:DateTimePicker Format="Custom" FormatString="dd-MMM-yyyy" Watermark="Select Date" /> Commented Jun 30, 2011 at 8:16

3 Answers 3

6

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

Sign up to request clarification or add additional context in comments.

Comments

0

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;

Comments

-2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.