Skip to main content
All docs
V23.2

GanttControl.SplitTaskSource Property

Gets or sets the data source that contains information about split tasks.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v23.2.dll

NuGet Package: DevExpress.Win.Gantt

Declaration

[DefaultValue(null)]
[DXCategory("Data")]
public object SplitTaskSource { get; set; }

Property Value

Type Default Description
Object null

An object that specifies a data source.

Remarks

The SplitTaskSource property specifies a data source that contains information about interruptions in tasks. A data source record contains information about an interruption: the task, the interruption start date, and the duration of the interruption in work hours.

The GanttControl.SplitTaskMappings property allows you to specify the following mappings to data fields:

  • KeyFieldName — a split task’s identifier.

    The DataSource property specifies the data source that contains tasks. To specify the data source field that contains task identifiers, use the TreeListMappings.KeyFieldName property.

  • StartDateFieldName — the split start date. The data source field should contain a DateTime value.
  • DurationFieldName — the split duration. The data source field should contain a TimeSpan value that specifies an interruption in the work time.

    The control takes into account the workweek schedule when it calculates a task’s finish date or duration. For example, if a workday is 8 hours and the split duration is 16 hours, the actual interruption is 2 entire workdays. If the split duration is 2 days (48 hours), the actual interruption is 6 workdays.

How Splits Affect Task Finish Date and Duration

A task has a start date, finish date, and duration. To specify a task’s location on the time scale, you only need two of them: start and finish, or start and duration. See the following help topic for more information on how to specify the data fields that contain corresponding values: Bind to Data Source. The control calculates the unspecified parameter (duration or finish date) when tasks are loaded from the data source as follows:

  • If you have specified the start and finish dates — task splits reduce the duration, but do not change the finish date.
  • If you have specified the start date and duration — task splits postpone the finish date, but do not change the duration.

Note that after tasks are loaded (finish dates/durations are calculated), the control can only update the finish date (but not the duration) when a task’s split duration is changed.

Example

The code below shows a sample data source that contains information about task splits.

ganttControl1.SplitTaskMappings.StartDateFieldName = "StartDate";
ganttControl1.SplitTaskMappings.DurationFieldName = "Duration";
ganttControl1.SplitTaskMappings.KeyFieldName = "UID";

List<TaskSplitInfo> splitInfo = new List<TaskSplitInfo>();
splitInfo.Add(new TaskSplitInfo() { UID = "8", StartDate = tasks[8].StartDate + TimeSpan.FromHours(2), Duration = TimeSpan.FromHours(8)});
splitInfo.Add(new TaskSplitInfo() { UID = "9", StartDate = tasks[9].StartDate + TimeSpan.FromHours(5), Duration = TimeSpan.FromDays(1)});
splitInfo.Add(new TaskSplitInfo() { UID = "10", StartDate = tasks[10].StartDate + TimeSpan.FromHours(4), Duration = TimeSpan.FromHours(4) });
splitInfo.Add(new TaskSplitInfo() { UID = "10", StartDate = tasks[10].StartDate + TimeSpan.FromDays(2) + TimeSpan.FromHours(2), Duration = TimeSpan.FromHours(4) });
ganttControl1.SplitTaskSource = splitInfo;

public class TaskSplitInfo {
    public string UID { get; set; }
    public DateTime StartDate { get; set; }
    public TimeSpan Duration { get; set; }
}
See Also