Customizing WPF DatePicker Mask
<p>I need to change the string format of the DatePickerTextBox in the WPF DatePicker to "dd/MM/YYYY" insted of "mm/dd/yyyy".
I want to allow users to add a date manually.
When i'm typing in TextBox in this format: "mm/dd/yyyy" the date in DatePicker Changing. But when i'm typing in this format: "dd/MM/yyy" i'm getting an error.
I tried: StringFormat='dd/MM/yyyy' but it didn't help:</p>

<pre><code>       &lt;DatePicker x:Name="DateGviya" Text = "{Binding NameOfMyProperty, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, TargetNullValue=''}"&gt;
                &lt;DatePicker.Resources&gt;
                    &lt;Style TargetType="{x:Type DatePickerTextBox}"&gt;
                        &lt;Setter Property="Control.Template"&gt;
                            &lt;Setter.Value&gt;
                                &lt;ControlTemplate&gt;
                                    &lt;TextBox x:Name="PART_TextBox" Text="{Binding Path=SelectedDate, StringFormat='dd/MM/yyyy', RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}}" /&gt;
                                &lt;/ControlTemplate&gt;
                            &lt;/Setter.Value&gt;
                        &lt;/Setter&gt;
                    &lt;/Style&gt;
                &lt;/DatePicker.Resources&gt;
            &lt;/DatePicker&gt;
</code></pre>