Skip to main content
A newer version of this page is available. .

Data Source

  • 3 minutes to read

The GanttControl.DataSource property allows you to specify the control’s data source.

Field Names

The following properties specify data source fields that contain the data required by the control to display the project schedule (hierarchy, dates, dependencies, etc.):

Hierarchy

Tasks

Baselines

Baselines are only displayed if the GanttControl.OptionsView.ShowBaselines option is enabled.

Dependencies

How to Create Data Source in Code

The code below shows how to initialize tree list and chart mappings.

GanttControl ganttControl = new GanttControl();
ganttControl.TreeListMappings.KeyFieldName = "Id";
ganttControl.TreeListMappings.ParentFieldName = "ParentId";
ganttControl.ChartMappings.TextFieldName = "Name";
ganttControl.ChartMappings.StartDateFieldName = "StartTime";
ganttControl.ChartMappings.FinishDateFieldName = "EndTime";
ganttControl.ChartMappings.ProgressFieldName = "Progress";
ganttControl.ChartMappings.PredecessorsFieldName = "PredecessorIDs";
ganttControl.DataSource = Task.GetData();

public class Task {
    public int Id { get; set; }
    public int ParentId { get; set; }
    //
    public string Name { get; set; }
    public DateTime StartTime { get; set; }
    public DateTime EndTime { get; set; }
    public TimeSpan Duration { get; set; }
    public double Progress { get; set; }
    //
    public IReadOnlyList<int> PredecessorIDs {
        get; private set;
    }
}

Note

Run the Gantt Code Examples demo to see the complete example.