I'm trying to set a date format for the CalendarDatePicker for globalisation purposes. I tried this:
endDate = (FindName("cdpEnd") as CalendarDatePicker);
endDate.DateFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
endDate.Date = workObject.EndCal;
But it gave me the following exception:
System.ArgumentException: The parameter is incorrect.
formatTemplate
at Windows.UI.Xaml.Controls.CalendarDatePicker.put_DateFormat(String value)
at App1.PageWorkObject.rootGrid_Loaded(Object sender, RoutedEventArgs e)
I checked the value I had set and it looked normal to me: "M/d/yyyy"
What am I doing wrong?