GanttControl.SplitTask(Int32, DateTime, TimeSpan) Method
In This Article
Splits the specified task.
Namespace: DevExpress.XtraGantt
Assembly: DevExpress.XtraGantt.v24.2.dll
NuGet Package: DevExpress.Win.Gantt
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
node |
Int32 | A task’s Id property value. |
split |
Date |
The split start date. |
split |
Time |
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);
}
See Also