microsoft / AppConsult-WinAppsModernizationWorkshop

Windows Apps modernization workshop
MIT License
67 stars 35 forks source link

COMException ocurred at end of Exercise 4. #46

Closed runceel closed 5 years ago

runceel commented 5 years ago

When selecting same date on the CalenderViewWrapper control, then following error is occurred.

image

I think that you need the length check before accessing AddedDates property at the SelectedDatesChanged event handler like below:

private void CalendarView_SelectedDatesChanged(CalendarView sender, CalendarViewSelectedDatesChangedEventArgs args)
{
    // Add using System.Linq;
    if (args.AddedDates.Any())
    {
        SelectedDate = args.AddedDates[0];
    }
}
qmatteoq commented 5 years ago

Fixed in 6781dd0