Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GanttView.DurationMapping Property

Provides a path to a data field that stores the task’s duration. This is a dependency property.

Namespace: DevExpress.Xpf.Gantt

Assembly: DevExpress.Xpf.Gantt.v24.2.dll

NuGet Package: DevExpress.Wpf.Gantt

#Declaration

public Mapping DurationMapping { get; set; }

#Property Value

Type Description
Mapping

A Mapping object indicating the data field and the converter.

#Remarks

Use the DurationMapping property to bind the Gantt item’s GanttNode.Duration property to a data field. The data field is obtained from the data source specified by the GanttControl’s ItemsSource property.

Tip

Use the Mapping.Converter property to register a value converter for a custom storing format.

You can specify mapping as a Mapping markup extension object, or as a string. The code sample below illustrates how to map Gantt items’ properties to data source fields.

<dxgn:GanttControl ItemsSource="{Binding Tasks}">
    ...
    <dxgn:GanttControl.View>
        <dxgn:GanttView
            KeyFieldName="Id"
            ParentFieldName="ParentId"

            NameMapping="{dxgn:Mapping Name}"
            StartDateMapping="StartDate"
            DurationMapping="{dxgn:Mapping Duration}"
            ProgressMapping="Progress"
            BaselineStartDateMapping="BaselineStartDate"
            BaselineFinishDateMapping="BaselineFinishDate"

            PredecessorLinksPath="Links">
            <dxgn:GanttView.PredecessorLinkMappings>
                <dxgn:GanttPredecessorLinkMappings Task="Id" PredecessorTask="PredecessorId"/>
            </dxgn:GanttView.PredecessorLinkMappings>
        </dxgn:GanttView>
    </dxgn:GanttControl.View>
</dxgn:GanttControl>

Note

The task’s duration means the working time span.

Example

You have the following working time rules:

  • working time per day is 8 hours,
  • task’s duration is set to 1 day (24 hours).

In this case, the tasks duration is 24 working time hours (3 working days).

See Also