Articles in this section

How to load appointments on demand in WinUI Scheduler?

The WinUI scheduler supports load appointments on-demand with a loading indicator.

C#

Use QueryAppointments to load the appointments in on-demand for the visible date range. Loading appointments in on-demand improves the loading performance when you have appointments ranging for multiple years. Start and stop the loading indicator animation before and after the appointments are loaded using the ShowBusyIndicator.

private async void OnScheduleQueryAppointments(object sender, QueryAppointmentsEventArgs e)
{
    schedule.ShowBusyIndicator = true;
    await Task.Delay(1000);
    schedule.ItemsSource = this.GenerateSchedulerAppointments(e.VisibleDateRange);
    schedule.ShowBusyIndicator = false;
}
 
private IEnumerable GenerateSchedulerAppointments(DateRange dateRange)
{
    Random random = new Random();
    int daysCount = (dateRange.ActualEndDate - dateRange.ActualStartDate).Days;
    var appointments = new ObservableCollection<ScheduleAppointment>();
 
    for (int i = 0; i < 50; i++)
    {
        var startTime = dateRange.ActualStartDate.AddDays(random.Next(0, daysCount + 1)).AddHours(random.Next(0, 24));
        appointments.Add(new ScheduleAppointment
        {
            StartTime = startTime,
            EndTime = startTime.AddHours(1),
            Subject = subjectCollection[random.Next(0, subjectCollection.Count)],
            AppointmentBackground = brush[random.Next(0, brush.Count)],
        });
    }
    return appointments;
}

XAML

Trigger the QueryAppointments event for the WinUI Scheduler.

<Grid x:Name="grid">
    <syncfusion:SfScheduler x:Name="scheduler"
                            ViewType="Month" QueryAppointments="OnScheduleQueryAppointments"
                            >
    </syncfusion:SfScheduler>
</Grid>

Load appoinmtments on demand

Take a moment to pursue the documentation. You can also find the options available for the load on Demand Command in the Schedule.



 

Conclusion

I hope you enjoyed learning about ow to load appointments on demand in WinUI Scheduler.

You can refer to our  WinUI Calendar feature tour page to know about its other groundbreaking feature representations. You can also explore our WinUI Calendar documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied