Skip to content

Commit

Permalink
Fix not updating the text of TimePicker and DateTimePicker after …
Browse files Browse the repository at this point in the history
…changing the culture
  • Loading branch information
punker76 committed Sep 11, 2017
1 parent 3f60b85 commit 2c1c692
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/release-notes/1.6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
+ `GroupBoxHeaderThemePadding` (default 4)
+ `ExpanderHeaderThemePadding` (default 2)
+ `ExpanderToggleButtonEllipseThemeSize` (default 18)
- Fix not updating the text of `TimePicker` and `DateTimePicker` after changing the culture.

## Breaking Change

Expand Down Expand Up @@ -75,3 +76,4 @@ More informations about the reason of this decision can be found here:
- [#3025](/~https://github.com/MahApps/MahApps.Metro/issues/3025) ComboBox popup border thickness problem
- [#3043](/~https://github.com/MahApps/MahApps.Metro/issues/3043) Width parse error
- [#3045](/~https://github.com/MahApps/MahApps.Metro/issues/3045) Clicking on the "X" button added by TextBoxHelper.ClearTextButton does not clear the databinding target
- [#3049](/~https://github.com/MahApps/MahApps.Metro/issues/3049) TimePicker fails to parse times with an AM/PM. [#3050](/~https://github.com/MahApps/MahApps.Metro/pull/3050) [@toddburnside](/~https://github.com/toddburnside)
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ protected virtual void ApplyCulture()

SetDefaultTimeOfDayValues();
_deactivateRangeBaseEvent = false;

WriteValueToTextBox();
}

protected Binding GetBinding(DependencyProperty property)
Expand All @@ -466,8 +468,7 @@ protected virtual string GetValueForTextBox()

protected virtual void OnTextBoxLostFocus(object sender, RoutedEventArgs e)
{
var text = DateTime.MinValue.ToString(SpecificCultureInfo.DateTimeFormat.ShortDatePattern) + " " +
((DatePickerTextBox)sender).Text;
var text = string.Intern($"{DateTime.MinValue.ToString(SpecificCultureInfo.DateTimeFormat.ShortDatePattern)} {((DatePickerTextBox)sender).Text}");
DateTime dt;
if (DateTime.TryParse(text, SpecificCultureInfo, DateTimeStyles.None, out dt))
{
Expand Down

0 comments on commit 2c1c692

Please sign in to comment.