Skip to main content
All docs
V24.2

AppointmentCRUDEventArgs.DeleteFromSource Property

Returns the list of appointments to delete from the data source.

Namespace: DevExpress.Xpf.Scheduling

Assembly: DevExpress.Xpf.Scheduling.v24.2.dll

NuGet Package: DevExpress.Wpf.Scheduling

Declaration

public IReadOnlyList<AppointmentItem> DeleteFromSource { get; }

Property Value

Type Description
IReadOnlyList<AppointmentItem>

A list of DevExpress.Xpf.Scheduling.AppointmentItem objects that have been deleted from the scheduler.

Remarks

When a user updates or deletes a pattern, the scheduler deletes all ChangedOccurrence and DeletedOccurrence appointments for the corresponding recurring series. The Occurrence appointments are not stored in any collection to avoid a stack overflow for infinite recurring series. These appointments are automatically generated at runtime based on the pattern’s AppointmentItem.RecurrenceInfo property.

When a user updates a pattern, the scheduler only adds the pattern appointment to the UpdateInSource and Appointments lists. The ChangedOccurrence and DeletedOccurrence appointments are added to the DeleteFromSource list.

When a user modifies or deletes an Occurrence appointment, the scheduler adds the corresponding exception (ChangedOccurrence or DeletedOccurrence) to the AddToSource and Appointments lists.

The code snippet below deletes appointments from the data source.

// data context
public class SchedulingContext : DbContext {
    public SchedulingContext() : base(CreateConnection(), true) { }
    static DbConnection CreateConnection() {
        //...
    }
    public DbSet<AppointmentEntity> AppointmentEntities { get; set; }
    public DbSet<ResourceEntity> ResourceEntities { get; set; }
}

// save changes to the data source
public void ProcessChanges(AppointmentCRUDEventArgs args) {
    using(var dbContext = new SchedulingContext()) {

        foreach(var appt in args.DeleteFromSource.Select(x => (AppointmentEntity)x.SourceObject))
            dbContext.AppointmentEntities.Remove(dbContext.AppointmentEntities.Find(appt.Id));

        dbContext.SaveChanges();
    }
}
See Also