SchedulerStorage.ResourceCollectionAutoReloading Event
Occurs when the data source which contains resources is modified and the automatic reloading of resources is enabled.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v24.1.dll
NuGet Package: DevExpress.Wpf.Scheduler
Declaration
Event Data
The ResourceCollectionAutoReloading event's data class is CancelListChangedEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Cancel | Gets or sets whether the operation performed on the processed event should be canceled. |
ListChangedType | Gets the type of change. Inherited from ListChangedEventArgs. |
NewIndex | Gets the index of the item affected by the change. Inherited from ListChangedEventArgs. |
OldIndex | Gets the old index of an item that has been moved. Inherited from ListChangedEventArgs. |
PropertyDescriptor | Gets the PropertyDescriptor that was added, changed, or deleted. Inherited from ListChangedEventArgs. |
Remarks
Important
You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.Xpf.Scheduling namespace. If you decide to upgrade an existing project in order to switch to the updated scheduler control, see the Migration Guidelines document.
You can use the DataMember and DataSource properties of the ResourceStorage object to bind SchedulerStorage to the data source which contains resources for appointments. In this case, resources will be automatically obtained from the specified data source.
When the AutoReload property of the ResourceStorage object is set to true, the data is automatically reloaded. In this case, the SchedulerStorage object reloads data from the data source each time an item in the data source is modified, added, moved or removed, a column is added, modified or deleted or multiple changes are made to the data source. The ResourceCollectionAutoReloading event allows you to prevent data from being reloaded in specific cases. Use the event’s ListChangedType parameter to determine the reason for the data source changes. To prevent data from being reloaded in a specific case, set the Cancel parameter to true. Otherwise, the scheduler storage object will always reload data from the data source immediately, after the event handler has completed.
The ResourceCollectionAutoReloading event doesn’t fire in the following cases:
- The data source which contains resources is not connected to the SchedulerStorage object.
- The ResourceStorage.AutoReload property is set to false.
Example
In the following example, the SchedulerStorage.AppointmentCollectionAutoReloading and SchedulerStorage.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;
// ...
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;
}