The datepicker control in WPF allow short and Long formats. By default it will take system date format.
So we can change the date format as our application requires like dd/MM/yyyy or MM/dd/YYYY,…
Need to write some couple of lines under Application_Startup Event in App.XAML.
Below is the code for custom date format.
Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
Thread.CurrentThread.CurrentCulture.DateTimeFormat.DateSeparator = "/";
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
This is event should be initiated from XAML code like below.
Happy Coding…
No comments:
Post a Comment