Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GanttControl.SplitTask(Int32, DateTime, TimeSpan) Method

Splits the specified task.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.2.dll

NuGet Package: DevExpress.Win.Gantt

#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