DatePicker日期格式化
DatePicker 控件有个默认的时间格式,它根据服务器上的时间格式来显示,若需要改变,可以通过以下方法进行修改:
App.xaml.cs 中添加
public App()
{
this.Startup += this.Application_Startup;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
//日期格式化
Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
}