GanttView for WPF | ComponentOne
In This Topic
    Task Splitting
    In This Topic

    GanttView provides task splitting feature to account for unanticipated work interruptions because of various factors, such as, addition of new tasks in existing plan, unavailability of resources, change in task priority or unplanned leaves. Using this feature, user can easily put a task on hold in the middle so that a part of it can be started later or another high priority task can be taken up. In addition, user can also split a task as many times according to the requirement.

    GanttView enables users to split task at runtime as well as through code. The Split Task button available in the toolbar splits a task into two or more segments.

    The following image shows task split into two segments in a GanttView.

    Task Splitter

    To split a task at runtime

    1. In the toolbar, click the Split Task button once.
      A screen tip appears, and the mouse pointer changes.
    2. Move the mouse pointer over the task bar of the task to be split.
    3. Move the mouse pointer to the date where you want the split segment to start.
    4. Click the mouse pointer at the desired start date.
    5. Drag the split segment to another date as per the schedule.

    Note: The screen tip contains the date at which the split segment is scheduled to start. As you move the mouse pointer along the task bar, the scheduled start date in the screen tip changes.

    A task can also be split at runtime by right clicking a specific point (date) on the task bar and selecting the Split Task option from the context menu. The Split Task option splits the task into two segments and adds a gap of one day in between. The split task segments can then be dragged to another date as per the user requirement.

    To split a task through code

    A task can be split through code by invoking the SplitTask method of the Task class. You can specify the start date of the task segment and the interruption duration in terms of number of days in the method to split a task. The following example illustrates splitting a task through code. This example uses the sample created in the Quick start.

    'Splitting a task into two segments
    gv.Tasks(2).SplitTask(gv.Tasks(2).Start.Value.AddDays(2), 2)
    
    //Splitting a task into two segments
    gv.Tasks[2].SplitTask(gv.Tasks[2].Start.Value.AddDays(2), 2);
    

    Limitations:

    By design, the task splitting feature of GanttView does not apply in the following conditions:

    1. If the split segment is scheduled to begin before the start date, or after the finish date of the task.
    2. If the duration of the task to be split is less than or equal to 1 day.
      If the DurationUnit is 'Days' and the duration is less than 1 day, then the task cannot be split.
      If the DurationUnit is 'Hours' and the duration is less than 24 hours, then the task cannot be split.
    3. If the main task begins on a nonworking day, then the split segment should begin on a working day.