Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set culture for a WPF DateTimePicker validation

I use a DateTimePicker on a WPF application. I would like to bind the .Text property to the SelectedDate, so I use binding like this:

<DatePicker x:Name="DateTimePicker_Date"
              Text="{Binding dDate, Mode=TwoWay,
                     UpdateSourceTrigger=PropertyChanged,
                     TargetNullValue='',
                     ValidatesOnDataErrors=True}"
              TabIndex="3"
              Grid.Column="1" />

My problem is I use an European culture, so: DAY/MONTH/YEAR instead of MONTH/DAY/YEAR, so if I input : 14/02/2013, I have a validation error !

How can I solve this?

like image 374
Walter Fabio Simoni Avatar asked May 15 '13 12:05

Walter Fabio Simoni


1 Answers

Solved :

Juste add a :

this.Language = XmlLanguage.GetLanguage("fr-FR");

In the code-behind of the windows :)

like image 149
Walter Fabio Simoni Avatar answered Oct 11 '22 01:10

Walter Fabio Simoni