Data refreshing on RadCalendar Views

2 posts, 0 answers
  1. Roshan
    Roshan avatar
    23 posts
    Member since:
    Apr 2012

    Posted 24 Oct Link to this post

    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,

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    488 posts

    Posted 25 Oct Link to this post

    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
Back to Top