This is a migrated thread and some comments may be shown as answers.

Some appointments not shown on first load

7 Answers 39 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shantimohan
Top achievements
Rank 1
Shantimohan asked on 21 Jun 2012, 07:16 PM
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)
{
    this.AllAppointments.Clear();
 
    foreach (EventViewModel appt in MainPage.mainViewModel.Appts)
    {
        this.AllAppointments.Add(new MyAppointment()
        {
            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)
    {
        this.AllAppointments.Add(new MyAppointment()
        {
            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
        });
    }
 
    this.OnDataLoaded();
}

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?

ThanQ...

7 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 22 Jun 2012, 07:46 AM
Hi Shantimohan,

Thank you for your interest in RadCalendar.

If you are following the pattern of the example, you should see the appointments in the Calendar itself as well. The FetchData method should be called when the MainPage is loaded. If you have done so, I'd like to ask you to prepare a sample project and send it to us, so that we can see what is preventing the appointments from showing.

Kind regards,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Shantimohan
Top achievements
Rank 1
answered on 25 Jun 2012, 02:04 AM
I was not using OnLoad event earlier. But now even using it as mentioned by you didn't help. Here is the sample project that I was trying.

0
Accepted
Valentin.Stoychev
Telerik team
answered on 28 Jun 2012, 11:41 AM
Hello,

We tested your code and it looks good and actually works as expected on our end.

What you can check is if on the first load you have the phone appointments added in the PhoneEvents collection. Did you check if this method - PhoneAppointments_SearchCompleted - is executed before adding the appointments in the Calendar?

Please check these two things and let us know if you need more help!

All the best, Valentin.Stoychev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Shantimohan
Top achievements
Rank 1
answered on 03 Jul 2012, 11:49 PM
While debugging as suggested by you, I realized that the FetchData() method is called by the constructor also. So initializing the eventSource in the PhoneAppointments_SearchCompleted event handler at the end after getting the appointments from phone's calendar and adding them to the AllAppointments list has resolved my issue.

It's a great control.

ThanQ...
0
Wolfshund
Top achievements
Rank 2
answered on 04 Jul 2012, 06:35 AM
I'm also trying to bind the phone's calender (appointment) data to the Radcalendar, but without any success yet. Is there a simple sample available and also are there any restrictions in accessing the phone's calendar data?   
Thanks.
0
Shantimohan
Top achievements
Rank 1
answered on 04 Jul 2012, 11:54 AM
@Wolfsund, Check the 'sample project' link in my post on Jun 24th. Then you will have to make changes mentioned in my yesterday's post. Let me know if you have any issues with the code.

There is no other restriction in getting phone's appointments other than that 'it is read only'. You can't edit them in place. Also if an appointment is marked 'private' then you don't get only the start and end date & time. The subject, details and location fields will be null for 'private' marked appointments.

Hope this helps you.

ThanQ...
0
Wolfshund
Top achievements
Rank 2
answered on 05 Jul 2012, 04:30 AM
@Shantimohan
Thank you for you help and information.
I had a first look at your 'sample project' and got some ambiguous marked error messages after opening the project. Just investigating what might be wrong on my side.
For the private appointments, at least there is enough information to show a 'private appointment' or something else entry.
Yeah, you're right, the calendar is a great control, I have used it much with custom appointment sources.

Thanks.
Tags
Calendar
Asked by
Shantimohan
Top achievements
Rank 1
Answers by
Todor
Telerik team
Shantimohan
Top achievements
Rank 1
Valentin.Stoychev
Telerik team
Wolfshund
Top achievements
Rank 2
Share this question
or