In an xamWebGrid, for a DateColumn column, the default date appears to be formatted 1/1/2002. I want to always display in 01/01/2002 format. Can you tell me how to set the format of the date?
Thanks!
Hi,
The DatePicker control itself uses the format, specified in your CurrentCulture settings.
The only thing you can change about DatePicker's display format is whether it should display Long date or Short date. Again, the patterns of Long and Short dates are taken from your culture settings.
One thing you could do is to modify the culture settings for your application (e.g., change the short date pattern). You could do this is by adding the following code to your App.xaml.cs file:
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy";
}
Hope that helps,
Hi Georgi,
Thanks, it works great!