I am building a sample WP7 app to do things the way I will be implementing. In this I have appointments created by my own app and also get the appointments from the phone. So I was using the 'ContactsAndCalendar' example from MSDN. I added a new PivotItem to it in which I added code modeled on that in your 'AppointmentViewer' project in the downloaded samples.
I do create sample data into the ObservableCollection Appts. I also populate another ObservableCollection PhoneAppts with that from the phone through AppointmentSearch API.
My FetchData() code is as below:
public override void FetchData(DateTime startDate, DateTime endDate)
foreach (EventViewModel appt in MainPage.mainViewModel.Appts)
Subject = appt.EventDesc,
StartDate = appt.DateBegin,
EndDate = appt.DateEnd,
EventID = appt.EventID,
TimeDuration = appt.DateEnd - appt.DateBegin,
CurrentStatus = appt.CurrentStatus,
Importance = appt.Importance,
EventLocation = appt.EventLocation,
EventSource = appt.EventSource,
EventNotes = appt.EventNotes
foreach (EventViewModel pappt in MainPage.mainViewModel.PhoneAppts)
Subject = pappt.EventDesc,
StartDate = pappt.DateBegin,
EndDate = pappt.DateEnd,
EventID = pappt.EventID,
TimeDuration = pappt.DateEnd - pappt.DateBegin,
CurrentStatus = pappt.CurrentStatus,
Importance = pappt.Importance,
EventLocation = pappt.EventLocation,
EventSource = pappt.EventSource,
EventNotes = pappt.EventNotes
Upon first loading the page, I see the 3 days of appointments (as shown by the filled date boxes) from the Appts only in the Calendar. I am not talking about the DataBoundLIstBox below it. I see empty date boxes for all other dates, where I do have PhoneAppts. I have two issues here:
1. When I click an empty date box, I do get those appointments listed in the DataBoundListBox. But the date boxes in the Calendar are still empty.
2. When I swipe up or down to other months, the date boxes get filled up.
How can I get those date boxes filled up on first loading with entries from PhoneAppt also?