All docs
V20.1
20.2 (EAP/Beta)
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GanttControl.TreeListMappings Property

Provides access to options specified based on data source field names and tree list column object.

Namespace: DevExpress.XtraGantt

Assembly: DevExpress.XtraGantt.v20.1.dll

Declaration

[XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)]
public TreeListMappings TreeListMappings { get; }
<XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)>
Public ReadOnly Property TreeListMappings As TreeListMappings

Property Value

Type Description
TreeListMappings

An object that contains options specified based on data source field names and tree list column object.'

Examples

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

ganttControl1.TreeListMappings.KeyFieldName = "ID";
ganttControl1.TreeListMappings.ParentFieldName = "ParentID";
ganttControl1.ChartMappings.TextFieldName = "Text";
ganttControl1.ChartMappings.StartDateFieldName = "StartDate";
ganttControl1.ChartMappings.FinishDateFieldName = "FinishDate";
ganttControl1.ChartMappings.BaselineStartDateFieldName = "BaselineStartDate";
ganttControl1.ChartMappings.BaselineFinishDateFieldName = "BaselineFinishDate";
ganttControl1.OptionsView.ShowBaselines = true;
ganttControl1.ChartMappings.PredecessorsFieldName = "Predecessors";
ganttControl1.DataSource = GetTasks();

DataTable GetTasks() {
    DataTable table = new DataTable();
    DataColumn id = new DataColumn("ID", typeof(int));
    DataColumn parentId = new DataColumn("ParentID", typeof(int));
    DataColumn text = new DataColumn("Text", typeof(string));
    DataColumn start = new DataColumn("StartDate", typeof(DateTime));
    DataColumn finish = new DataColumn("FinishDate", typeof(DateTime));
    DataColumn startBaseline = new DataColumn("BaselineStartDate", typeof(DateTime));
    DataColumn finishBaseline = new DataColumn("BaselineFinishDate", typeof(DateTime));
    DataColumn predecessors = new DataColumn("Predecessors", typeof(string));
    table.Columns.AddRange(new DataColumn[] { id, parentId, text, start, finish, startBaseline, finishBaseline, predecessors });
    table.Rows.Add(new object[] { 1, 0, "Task 1", DateTime.Now, DateTime.Now.AddDays(1), DateTime.Now, DateTime.Now.AddDays(1.5), null });
    table.Rows.Add(new object[] { 2, 0, "Task 2", DateTime.Now.AddDays(1), DateTime.Now.AddDays(2), DateTime.Now.AddDays(1), DateTime.Now.AddDays(1.5), 1 });
    table.Rows.Add(new object[] { 3, 0, "Task 3", DateTime.Now.AddDays(2), DateTime.Now.AddDays(3), DateTime.Now.AddDays(2), DateTime.Now.AddDays(3), "1, 2" });
    return table;
}
See Also