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.1.dll

Declaration

public class AppointmentDragResizeViewModel :
    AppointmentEditViewModelBase
Public Class AppointmentDragResizeViewModel
    Inherits AppointmentEditViewModelBase

Related API Members

The following members accept/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.

Examples

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.

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