DatePicker and CultureInfo

Nov 4, 2008 at 10:31 PM



I’m not so familiar with the Xaml in Wpf.

How to set the CultureInfos ShortDatePattern for the DatePicker.SelectedDateFormat in Xaml and how to create a DataGridTemplateColumn at runtime?


Thanks in advance.


Nov 5, 2008 at 12:38 AM
Have you tried setting the SelectedDateFormat attribute in your DatePicker XAML tag to "Short"?

-Eric Fabricant, MSFT
Nov 5, 2008 at 3:52 PM
Does the DatePicker supports DateFormat accordingly to the current culture?
Nov 5, 2008 at 7:37 PM

Sorry, my misstake. Yes, DatePicker does, the underlying TextBox in a DataGridCell does not.

I don’t know how to set the StringFormat of the TextBox to set something like that:            

TextBox.StringFormat = CultureInfo.DateTimeFormat.ShortDatePattern;


Thanks in advance.