Skip to main content
A newer version of this page is available. .
All docs
V20.2

Automatic Scheduling

  • 4 minutes to read

Users can edit tasks in the task list or in the chart — move a task to change its start date, resize a task to change its finish date, create a new or change an existing dependency. If a task has dependent tasks, the control automatically reschedules them. For example, if a user postpones a task, the control also moves all its successor tasks.

Note

The control reschedules tasks only if a user updates a task in the task list or in the chart, or you use the control’s property or method to update a task in code. If you update a task in the data source, the control only reflects changes, but does not reschedule tasks.

Use the ScheduleMode option to specify whether the control automatically reschedules tasks. To access this option, use the GanttControl.OptionsBehavior property.

using DevExpress.XtraGantt.Options;

ganttControl1.OptionsBehavior.ScheduleMode = ScheduleMode.Auto;

How the Control Reschedules Tasks

The control reschedules tasks according to types of dependencies between them:

  • FinishToStart — a successor should start when its predecessor finishes.

  • FinishToFinish — a successor should finish when its predecessor finishes.

  • StartToFinish — a successor should finish when its predecessor starts.

  • StartToStart — a successor should start when its predecessor starts.

Note

The control does not update a task’s start or finish date according to the specified dependencies when tasks are loaded from the data source. The specified dependencies are only taken into account to reschedule tasks.

See the following topic for more information on how to specify a data source that contains dependencies: Task Dependencies.

Time Lags

The data source allows you to specify a time lag between dependent tasks. For a finish-to-start or start-to-start dependency, the time lag is a delay of the successor task’s start date. For a finish-to-finish or start-to-finish dependency, the time lag is a delay of the successor task’s finish date. When the control reschedules tasks, it also takes into account the specified time lags.

The image below illustrates two tasks with a finish-to-start dependency — the second task starts with a time lag of one hour after the first task finishes.

Note

The control does not update a task’s start or finish date according to the specified time lag when tasks are loaded from the data source. The specified time lags are only taken into account to reschedule tasks.

If a user creates a new dependency between tasks, the control reschedules the dependent task according to the newly created dependency type. The control creates a new dependency without a time lag. You can handle the control’s events to allow the user to specify the time lag. See the following topic for more information on how to customize edits in the chart: Interactive Editing.

Workweek Schedule

The control takes into account the workweek schedule and holidays to reschedule tasks. For example, if a predecessor task finishes before a holiday and a successor task should start when the predecessor task finishes (the finish-to-start dependency type), the successor task starts after the holiday. See the following topic for more information on how to specify the workweek schedule: Workweek Schedule and Exceptions.

The image below illustrates two tasks with a finish-to-start dependency — the second task starts with a time lag of one hour after the first task finishes. Note that since the first task finishes at the end of a work day, the second task only starts on a new work day with respect to the time lag. That is how the control takes into account the workweek schedule when it reschedules the project.

If there is a time lag between two tasks, the control reschedules tasks with respect to the workweek schedule and the time lag.

Force the Control to Reschedule All Tasks

You can call the ScheduleFromStartDate(DateTime) or ScheduleToFinishDate(DateTime) method to forcibly reschedule all tasks in the project so that they start or finish on the specified date.

ganttControl1.ScheduleFromStartDate(DateTime.Now);

Adjust Automatic Scheduling

The GanttControl.CustomTaskScheduling event fires before a task is rescheduled and allows you to specify custom start and finish dates. You can also use this event to cancel a reschedule of the current task and stop the process for its successors. See the following topic for an example: How to: Adjust Automatic Scheduling.