Skip to content

Commit

Permalink
(GH-3286) Fix for: DateTimePicker: Calendar.SelectedDate not always u…
Browse files Browse the repository at this point in the history
…pdated and consistent

Closes #3286
  • Loading branch information
punker76 committed Dec 7, 2018
1 parent c70a970 commit 7006dcd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MahApps.Metro/Controls/TimePicker/DateTimePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ protected override void ApplyBindings()

if (_calendar != null)
{
_calendar.SetBinding(Calendar.SelectedDateProperty, GetBinding(SelectedDateTimeProperty));
_calendar.SetBinding(Calendar.DisplayDateProperty, GetBinding(DisplayDateProperty));
_calendar.SetBinding(Calendar.DisplayDateStartProperty, GetBinding(DisplayDateStartProperty));
_calendar.SetBinding(Calendar.DisplayDateEndProperty, GetBinding(DisplayDateEndProperty));
Expand Down Expand Up @@ -270,7 +271,7 @@ private void SetDatePartValues()
var dateTime = GetSelectedDateTimeFromGUI();
if (dateTime != null)
{
DisplayDate = dateTime.Value > DateTime.MinValue && dateTime.Value < DateTime.MaxValue ? dateTime.Value : DateTime.Today;
this.SetCurrentValue(DisplayDateProperty, dateTime.Value > DateTime.MinValue && dateTime.Value < DateTime.MaxValue ? dateTime.Value : DateTime.Today);
if ((SelectedDateTime != DisplayDate && SelectedDateTime != DateTime.MinValue) || (Popup != null && Popup.IsOpen))
{
this.SetCurrentValue(SelectedDateTimeProperty, DisplayDate);
Expand Down

0 comments on commit 7006dcd

Please # to comment.