How to: Split Appointments and Series

  • 2 minutes to read

This document describes a tool that enables users to split an appointment in two by dragging a splitter line over it. This is especially convenient if you need to divide recurring appointments. All you have to do is to select a Split command in the context menu of the selected appointment, position a splitter at the required time and click the left mouse button.

The following pictures illustrate what the splitter looks like in different Scheduler views:

DayView

SplitDayView

Timeline View

SplitTimelineView

By executing the Split command, you enter the Split mode of the Scheduler. In this mode, all user input is directed to the command handler. You have the option to specify the time at which the appointment should be split or cancel the operation.

The split time is indicated in the tooltip, along with the time resolution of a splitter movement. The resolution is set automatically according to the appointment's duration and varies from one hour to one minute. You can adjust it manually using the mouse wheel.

Clicking the right mouse button or pressing ESC leaves the Split mode and restores normal operation.

The following illustrations show the Scheduler before and after the split operation is applied to a recurring appointment.

Before:

SplitDayRecurBefore

After:

SplitDayRecurAfter

The series is split into two independent series of recurring appointments, with the end time of the first series being equal to the start time of the next series.

The tool is activated by the DevExpress.XtraScheduler.Commands.SplitAppointmentOperationCommand. You can associate this command with the context menu item, as illustrated in the CodeCentral example available online: How to split appointment.

Handle the SchedulerControl.PreparePopupMenu event to add a menu item which executes the command and invokes the Split tool:

void schedulerControl_PopupMenuShowing(object sender, DevExpress.XtraScheduler.PopupMenuShowingEventArgs e)
{
    if (e.Menu.Id == DevExpress.XtraScheduler.SchedulerMenuItemId.AppointmentMenu) {
        SplitAppointmentOperationCommand command = new SplitAppointmentOperationCommand(schedulerControl);
        SchedulerMenuItemCommandWinAdapter menuItemCommandAdapter = new SchedulerMenuItemCommandWinAdapter(command);
        DXMenuItem menuItem = (DXMenuItem)menuItemCommandAdapter.CreateMenuItem(DXMenuItemPriority.Normal);
        menuItem.BeginGroup = true;
        e.Menu.Items.Add(menuItem);
}
}