Back to Devexpress

SchedulerDataStorage.AppointmentsDeleted Event

windowsforms-devexpress-dot-xtrascheduler-dot-schedulerdatastorage-82f3fde5.md

latest8.7 KB
Original Source

SchedulerDataStorage.AppointmentsDeleted Event

Occurs after one or more appointments have been deleted from the SchedulerDataStorage.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public event PersistentObjectsEventHandler AppointmentsDeleted
vb
Public Event AppointmentsDeleted As PersistentObjectsEventHandler

Event Data

The AppointmentsDeleted event's data class is PersistentObjectsEventArgs. The following properties provide information specific to this event:

PropertyDescription
ObjectsGets the persistent objects for which the event occurs.

Remarks

The AppointmentsDeleted event notifies that one or more appointments were removed from the SchedulerDataStorage. Use the e.Objects event parameter to obtain deleted appointments (DevExpress.XtraScheduler.Internal.Implementations.AppointmentItem).

csharp
using DevExpress.XtraScheduler;
using DevExpress.XtraScheduler.Internal.Implementations;

void SchedulerDataStorage_AppointmentsDeleted(object sender, PersistentObjectsEventArgs e)
{
    // Create a list to store IDs of deleted appointments.
    List<object> ids = new List<object>();

    // Iterate through deleted appointments and collect their IDs.
    foreach (AppointmentItem apt in e.Objects)
    {
        ids.Add(apt.Id);
    }
    // Update your underlying data source.
    // For example, remove corresponding records from a database or in-memory collection.
    // ...
}

If you delete multiple appointments in code and wrap this code in BeginUpdate \ EndUpdate method calls, the AppointmentsDeleted event fires only once.

Tip

Handle the SchedulerDataStorage.AppointmentDeleting event to conditionally cancel the deletion of specific appointments.

Warning

Do not modify the SchedulerDataStorage data (for example, the AppointmentCollection collection or individual appointment items) within the AppointmentsDeleted event handler. Changes made at this point may be overwritten or ignored, and may not take effect.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AppointmentsDeleted event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-scheduler-create-appointment-edit-form-with-custom-fields/CS/SimpleCustomFields/Form1.cs#L22

csharp
schedulerDataStorage1.AppointmentsChanged += new PersistentObjectsEventHandler(this.OnApptChangedInsertedDeleted);
schedulerDataStorage1.AppointmentsDeleted += new PersistentObjectsEventHandler(this.OnApptChangedInsertedDeleted);

winforms-scheduler-optimize-performance-large-dataset/CS/FetchAppointmentExample/Form1.cs#L28

csharp
schedulerDataStorage1.AppointmentsInserted += OnApptChangedInsertedDeleted;
schedulerDataStorage1.AppointmentsDeleted += OnApptChangedInsertedDeleted;

winforms-scheduler-custom-appointment-edit-form/CS/SchedulerDbExample/Form1.cs#L27

csharp
this.schedulerDataStorage1.AppointmentsInserted += OnAppointmentChangedInsertedDeleted;
    this.schedulerDataStorage1.AppointmentsDeleted += OnAppointmentChangedInsertedDeleted;
}

winforms-scheduler-bind-to-ms-sql-server/CS/SchedulerSQLRuntime/Form1.cs#L15

csharp
this.schedulerDataStorage1.AppointmentsChanged += OnApptChangedInsertedDeleted;
this.schedulerDataStorage1.AppointmentsDeleted += OnApptChangedInsertedDeleted;

how-to-implement-a-custom-inplace-editor-for-appointments-e4826/CS/SchedulerInplaceEditorExample/Form1.cs#L28

csharp
this.schedulerStorage1.AppointmentsInserted += OnAppointmentChangedInsertedDeleted;
this.schedulerStorage1.AppointmentsDeleted += OnAppointmentChangedInsertedDeleted;

winforms-scheduler-create-appointment-edit-form-with-custom-fields/VB/SimpleCustomFields/Form1.vb#L24

vb
AddHandler schedulerDataStorage1.AppointmentsChanged, AddressOf OnApptChangedInsertedDeleted
AddHandler schedulerDataStorage1.AppointmentsDeleted, AddressOf OnApptChangedInsertedDeleted

winforms-scheduler-optimize-performance-large-dataset/VB/FetchAppointmentExample/Form1.vb#L29

vb
AddHandler schedulerDataStorage1.AppointmentsInserted, AddressOf OnApptChangedInsertedDeleted
AddHandler schedulerDataStorage1.AppointmentsDeleted, AddressOf OnApptChangedInsertedDeleted
AddHandler schedulerControl1.VisibleIntervalChanged, AddressOf schedulerControl1_VisibleIntervalChanged

winforms-scheduler-custom-appointment-edit-form/VB/SchedulerDbExample/Form1.vb#L29

vb
AddHandler Me.schedulerDataStorage1.AppointmentsInserted, AddressOf OnAppointmentChangedInsertedDeleted
    AddHandler Me.schedulerDataStorage1.AppointmentsDeleted, AddressOf OnAppointmentChangedInsertedDeleted
End Sub

winforms-scheduler-bind-to-ms-sql-server/VB/SchedulerSQLRuntime/Form1.vb#L17

vb
AddHandler Me.schedulerDataStorage1.AppointmentsChanged, AddressOf OnApptChangedInsertedDeleted
AddHandler Me.schedulerDataStorage1.AppointmentsDeleted, AddressOf OnApptChangedInsertedDeleted

winforms-scheduler-create-gantt-chart/VB/GanttExample/Form1.vb#L24

vb
AddHandler schedulerDataStorage1.AppointmentsChanged, AddressOf schedulerDataStorage1_AppointmentsChanged
AddHandler schedulerDataStorage1.AppointmentsDeleted, AddressOf schedulerDataStorage1_AppointmentsDeleted
' #End Region ' #AppointmentEvents

See Also

DeleteAppointment(Appointment)

AllowAppointmentDelete

AppointmentDeleting

SchedulerDataStorage Class

SchedulerDataStorage Members

DevExpress.XtraScheduler Namespace