Skip to main content
A newer version of this page is available. .

AppointmentDragResizeViewModel Class

View model used in the drag-and-drop and resize operations, containing appointment property values which are modified during an action.

Namespace: DevExpress.Xpf.Scheduling

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

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Scheduling, DevExpress.Wpf.Scheduling

Declaration

public class AppointmentDragResizeViewModel :
    AppointmentEditViewModelBase

The following members return AppointmentDragResizeViewModel objects:

Remarks

The AppointmentDragResizeViewModel view model temporarily holds updated values of appointment properties modified in drag-and-drop or resize operations. The original appointment is available using the AppointmentEditViewModelBase.Appointment property. After the operation is complete, view model values are used to update the original appointment.

Example

This code snippet handles the SchedulerControl.AppointmentDrop event and determines whether the AppointmentDragResizeViewModel.Start property of the first appointment model in the collection of dragged appointments equals the SchedulerItemBase.Start property of the original appointment, available using the AppointmentEditViewModelBase.Appointment property. If this condition is met, a drop operation is allowed.

This restriction applies only to appointments with the “FixedTime” custom field value set to true.

Visually, appointments can only move between resources, preserving their Start and End times.

View Example

public void OnAppointmentDrop(DevExpress.Xpf.Scheduling.AppointmentItemDragDropEventArgs e)
{
    AppointmentDragResizeViewModel draggedViewModel = e.ViewModels.First() as AppointmentDragResizeViewModel;
    if (draggedViewModel.CustomFields["FixedTime"] != null)
        if ((bool)draggedViewModel.CustomFields["FixedTime"] &&
            (draggedViewModel.Start != draggedViewModel.Appointment.Start))
            e.Allow = false;
}

Inheritance

See Also