Skip to main content

GanttChartMappings.DurationFieldName Property

Gets or sets the data source field (of the TimeSpan type) that specifies a task’s duration (only work hours).

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v24.1.dll

NuGet Package: DevExpress.Win.Gantt

Declaration

[DefaultValue("")]
[DXCategory("Mappings")]
[XtraSerializableProperty]
public string DurationFieldName { get; set; }

Property Value

Type Default Description
String String.Empty

The data source field that specifies a task’s duration.

Remarks

The DurationFieldName property specifies the name of the data field that stores the duration for each task. The data field should contain values of the TimeSpan type.

Duration, Work Week Schedule, and Schedule Modes

Note that a task’s duration is the time taken to complete a task. This duration specifies only work hours. Note also that when the control reschedules a task in Auto mode, it takes into account the task’s duration and the work week schedule.

For example, the work day lasts 8 hours. If a task lasts 8 hours, it takes one work day to complete; if a task lasts 16 hours, it takes two work days to complete. That is why a 24-hour task (one day when counted in days) in the figure below takes three full work days to complete.

task duration 1

In Manual mode, the control does not take into account the work week schedule — all times are considered work times. In this mode, a 24-hour task takes exactly 24 hours to complete.

task duration 2

If you use all three time-related task properties (StartDate, FinishDate, Duration), make sure the Duration does not conflict with Start and Finish dates. Since the control draws tasks depending on Start and Finish dates, these conflicts can be masked until you try to edit a task. For example:

  • StartDate — February 10, 2021, 1:00 p.m.
  • FinishDate — February 11, 2021, 1:00 p.m.
  • Duration — 24 hours (1 day)
  • ScheduleMode — Auto
  • Work day duration — 8 hours

This setup introduces a conflict: the 24-hour task duration means a task should span across three days (eight working hours a day), which mismatches StartDate-FinishDate values. The control will draw a 24-hour task based on Start and Finish dates, but the 3-day duration will be stored internally, and will cause issues when a task is edited.

See Also