This is a migrated thread and some comments may be shown as answers.
Data refreshing on RadCalendar Views
1 Answer 27 Views
This is a migrated thread and some comments may be shown as answers.
RR
Top achievements
Rank 1
RR asked on 24 Oct 2017, 10:28 AM

I m using rad calendar and have a button outside where i fetch the events and i want to set them in the calendar. On the click I have fetch the events and set them to the AppointmentsSource of the calendar. But the calendar view does not seem to get updated, so the events not visible in the calendar. 

I can see the events are set to the AppointmentsSource but not visible in the view.

how to solve this. 

 

Thank you,

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 25 Oct 2017, 04:37 PM
Hello Roshan,

You have two primary options to refresh the Calendar's appointments:

1 - Reassign the ItemsSource after the new fetch

This is the easiest and most straightforward option. For example:

private void RefreshCalendar()
{
    // get new appointments
    var appts = GetUpdatedAppointments()
 
    // Scenario 1 - Appointments are in the view model and it's bound to the Calendar in XAML (make sure you have PropertyChanged notifications wired-up)
    var (MyCalendar.BindingContext as ViewModel).Appointments =  appts;
 
    // Scenario 2 - For code-behind, just reassign directly 
    MyCalendar.AppointmentsSource = appts;
}



2 - Use custom renderers to be able to call methods on the native control (via InvalidateUI on Windows, RebuildCalendar on Android and ReloadData on iOS)

This is more complex and would require either interface method implementation or Xamarin.Forms Messaging to communicate the signal to refresh.


Let us know if you have any further questions or concerns.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
RR
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or