In my wpf application, i have used DatePicker
control. I am having issue with the format of DatePicker
control. It doesn't take the form as i specified, instead of that it is taking the default system format. I have set the datetime format in my application startup file like below,
string currentCulture = AppSettings.Locale;
CultureInfo ci = new System.Globalization.CultureInfo(currentCulture);
ci.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
Thread.CurrentThread.CurrentUICulture = ci;
in xaml i have set ma selected date like below
SelectedDate="{Binding DateOfBirth, StringFormat='DD/MM/YYYY', Mode=TwoWay}"
in style i have set the text like below
Text="{Binding Path=SelectedDate, StringFormat='dd/MM/yyyy',
RelativeSource={RelativeSource AncestorType={x:Type DatePicker}}}">
What else i have missed ? why the format is not getting changed?Can anyone help me on this?
PS: I recently updated to .net framework version 4.7