Skip to main content
All docs
V24.2

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

AppointmentCRUDEventArgs Class

Namespace: DevExpress.Xpf.Scheduling

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

NuGet Package: DevExpress.Wpf.Scheduling

#Declaration

public class AppointmentCRUDEventArgs :
    RoutedEventArgs

#Remarks

The code snippet below saves changes to 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()) {
        dbContext.AppointmentEntities.AddRange(args.AddToSource.Select(x => (AppointmentEntity)x.SourceObject));

        foreach(var appt in args.UpdateInSource.Select(x => (AppointmentEntity)x.SourceObject))
            AppointmentEntityHelper.CopyProperties(appt, dbContext.AppointmentEntities.Find(appt.Id));

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

        dbContext.SaveChanges();
    }
}
See Also