Skip to content

Commit

Permalink
fix(calendardatepicker): fixed date picking were not working.
Browse files Browse the repository at this point in the history
  • Loading branch information
carldebilly authored and dr1rrb committed Jun 1, 2021
1 parent af2bf91 commit 7e170e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
CalendarIdentifier="{Binding SelectedItem.Content, ElementName=cid}"
Header="IsGroupLabelVisible=False"
PlaceholderText="--PLACEHOLDER--"
IsCalendarOpen="True"
IsGroupLabelVisible="False"
DayOfWeekFormat="{Binding SelectedItem.Content, ElementName=dowf}"
FirstDayOfWeek="{Binding SelectedItem.Content, ElementName=dow}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ internal override void OnPropertyChanged2(DependencyPropertyChangedEventArgs arg
}
else if (args.Property == CalendarDatePicker.DateProperty)
{
DateTime spNewDateReference;
DateTime spOldDateReference;
DateTime? spNewDateReference;
DateTime? spOldDateReference;
//CValueBoxer.UnboxValue<DateTime>(args.OldValue, spOldDateReference);
//CValueBoxer.UnboxValue<DateTime>(args.NewValue, spNewDateReference);
spOldDateReference = (DateTime)args.OldValue;
spNewDateReference = (DateTime)args.NewValue;
spOldDateReference = (DateTime?)args.OldValue;
spNewDateReference = (DateTime?)args.NewValue;
OnDateChanged(spOldDateReference, spNewDateReference);
}
else if (args.Property == FrameworkElement.LanguageProperty ||
Expand Down Expand Up @@ -306,7 +306,7 @@ private void OnSelectedDatesChanged(
if (!m_isSelectedDatesChangingInternally)
{
CalendarViewSelectionMode mode = CalendarViewSelectionMode.None;
m_tpCalendarView.SelectionMode = mode;
mode = m_tpCalendarView.SelectionMode;

// We only care about single selection mode.
// In case the calendarview's selection mode is set to multiple by developer,
Expand Down Expand Up @@ -361,7 +361,7 @@ private void OnDateChanged(
minDate = MinDate;
maxDate = MaxDate;
//coercedDate.UniversalTime = Math.Min(maxDate.UniversalTime, Math.Max(minDate.UniversalTime, date.UniversalTime));
coercedDate = new DateTime(Math.Min(maxDate.UtcTicks, Math.Min(minDate.UtcTicks, date.UtcTicks)), TimeSpan.Zero);
coercedDate = new DateTime(Math.Min(maxDate.UtcTicks, Math.Max(minDate.UtcTicks, date.UtcTicks)), TimeSpan.Zero);

// if Date is not in the range of min/max date, we'll coerce it and trigger DateChanged again.
//if (coercedDate.UniversalTime != date.UniversalTime)
Expand Down

0 comments on commit 7e170e2

Please sign in to comment.