Vero009
Vero009

Reputation: 622

How to change DatePicker DisplayDate?

How can i change DatePicker DisplayDate from mm/dd/yyyy to yyyy-mm-dd ?

Upvotes: 0

Views: 688

Answers (1)

Ray
Ray

Reputation: 46585

Change the SelectedDateFormat to 'yyyy-MM-dd'

If you want to set the culture correctly for your entire app, look at this question: StringFormat Localization issues in wpf.

You need this code somewhere that runs on startup.

FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), 
    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

Upvotes: 1

Related Questions