Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Prevent Appointments and Resources from Reloading

  • 2 minutes to read

In the following example the SchedulerDataStorage.AppointmentCollectionAutoReloading and SchedulerDataStorage.ResourceCollectionAutoReloading events are handled to prevent appointments and appointment resources from being reloaded from a data source in the following cases:

  • When a data source item (row) is being moved to a new position.
  • When a column (field) is added, modified or deleted in the data source.
 using System.ComponentModel;
 using DevExpress.XtraScheduler;
 // ...

 // Subscribe to the event which controls data reloading 
 // for the data source which contains appointments.
 schedulerControl.DataStorage.AppointmentCollectionAutoReloading += 
    new CancelListChangedEventHandler(OnCollectionAutoReloading);

 // Subscribe to the event which controls data reloading 
 // for the data source which contains appointment resources.
 schedulerControl.DataStorage.ResourceCollectionAutoReloading += 
    new CancelListChangedEventHandler(OnCollectionAutoReloading);


 private void OnCollectionAutoReloading(object sender, 
    CancelListChangedEventArgs e) {
    // Prevent data reloading when the data source is modified in specific cases.
    if(e.ListChangedType == ListChangedType.ItemMoved || e.ListChangedType == 
        ListChangedType.PropertyDescriptorAdded || 
        e.ListChangedType == ListChangedType.PropertyDescriptorChanged || 
        e.ListChangedType == ListChangedType.PropertyDescriptorDeleted)
       e.Cancel = true;
 }