Skip to main content

SchedulerControl.DropAppointment Event

Occurs when the user drops appointments within a Scheduler’s view.

Namespace: DevExpress.Xpf.Scheduling

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

NuGet Package: DevExpress.Wpf.Scheduling

Declaration

public event DropAppointmentEventHandler DropAppointment

Event Data

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

Property Description
AllowedEffects Returns a member of the DragDropEffects enumeration that specifies which operations are allowed by the originator of the drag event.
Cancel Gets or sets whether the event should be canceled. Inherited from CancelRoutedEventArgs.
ConflictedAppointments Returns the collection of dragged appointments that are conflicting with the current appointments.
Data Allows you to generate an appointment when the user drags an object in the Scheduler from an external source.
DragAppointments Returns the list of dragged appointments.
Effects Returns a member of the DragDropEffects enumeration that specifies which operation is the result of the drag-drop operation.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
IsFromOutside Indicates whether the content was dragged from an external control or application.
KeyStates Gets a flag enumeration indicating the current state of the SHIFT, CTRL, and ALT keys, as well as the state of the mouse buttons.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
SourceAppointments Provides access to the collection of dragged appointments before the drag-drop operation.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

Remarks

Set the event’s Cancel property to true to disable the default Scheduler’s drop behavior.

The example below illustrates how to override the AllowAppointmentConflicts property that is set to false.

private void Scheduler_DropAppointment(object sender, DropAppointmentEventArgs e) {
    for (int i = 0; i < e.DragAppointments.Count; i++) {
        //if a dragged appointment does not intersect another appointment
        if (e.ConflictedAppointments[i].Count == 0) {
            //it can be moved to the desired position
            e.SourceAppointments[i].Start = e.DragAppointments[i].Start;
            e.SourceAppointments[i].End = e.DragAppointments[i].End;
    }
}
See Also