Skip to main content
All docs
V24.2

GanttControl.SplitTask(Int32, DateTime, TimeSpan) Method

Splits the specified task.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.2.dll

Declaration

public void SplitTask(
    int nodeId,
    DateTime splitStart,
    TimeSpan splitDuration
)

Parameters

Name Type Description
nodeId Int32

A task’s Id property value.

splitStart DateTime

The split start date.

splitDuration TimeSpan

The split duration.

Remarks

Enable the AllowSplitTasks option and set the SplitTaskSource property to allow the Gantt control and users to split tasks. Read the following topic for detailed information: Split a Partially Completed Task.

Example

// Gets the focused task's ID.
int taskId = ganttControl1.FocusedNode.Id;
// Gets the task's start date.
DateTime? taskStart = ganttControl1.GetStartDate(taskId);
if(taskStart.HasValue) {
    // Specifies the split time.
    DateTime splitStart = taskStart.Value.AddDays(1);
    // Specifes the split duration.
    TimeSpan splitDuration = new TimeSpan(1, 0, 0);
    // Splits the focused task.
    ganttControl1.SplitTask(taskId, splitStart, splitDuration);
    // Reschedules all tasks from the specified date.
    ganttControl1.ScheduleFromStartDate(taskStart.Value);
}

Split Tasks - WinForms Gantt Control

See Also