Skip to main content
All docs
V24.1

Unbound Mode

  • 4 minutes to read

You can use a GanttControl if it is not bound to a data source. This mode requires that you create columns and nodes manually.

Tip

If you bind the control to a data source, it creates columns and nodes automatically based on the data source. See the following topic for more information: Bind to Data Source.

Add Columns and Nodes

You can create columns and nodes in the designer or in code. See the following topic for more information about the designer: Tree List Designer.

In code, call the Add, AddRange, AddField, or AddVisible method to add columns to the Columns collection. To create nodes, use an AppendNode method overload. Note that the DataSource property must be set to null (Nothing in VB.NET) to use the control in unbound mode.

image

using DevExpress.XtraTreeList.Data;

var column = ganttControl1.Columns.AddField("ID");
column.UnboundDataType = typeof(int);
column = ganttControl1.Columns.AddVisible("StartDate");
column.UnboundDataType = typeof(DateTime);
column = ganttControl1.Columns.AddVisible("FinishDate");
column.UnboundDataType = typeof(DateTime);
column = ganttControl1.Columns.AddField("Predecessors");
column.UnboundDataType = typeof(string);

var startDate = new DateTime(2021, 2, 15, 8, 0, 0);
var finishDate = new DateTime(2021, 2, 15, 17, 0, 0);

var rootNode = ganttControl1.AppendNode(new object[] { 0, startDate, finishDate, string.Empty }, null);
ganttControl1.AppendNode(new object[] { 1, startDate, finishDate, string.Empty }, rootNode);
ganttControl1.AppendNode(new object[] { 2, startDate, finishDate, "1" }, rootNode);
ganttControl1.AppendNode(new object[] { 3, startDate, finishDate, "2" }, rootNode);

ganttControl1.ScheduleFromStartDate(startDate);

Columns Specific to the Gantt Control

You can add any columns to a control but specific columns are required to display tasks in the chart area. For example, a task’s start and finish date are required to display the task on the timescale.

The table below contains columns (fields) that you can add to the control and their default names. You can either use default names or specify custom ones.

Column (Field)

Description

Default Column (Field) Name

Property that Specifies the Column (Field) Name

Start Date

A column that contains a task’s start date.

“StartDate”

StartDateFieldName

Finish Date

A column that contains a task’s finish date. You can use either Finish Date or Duration.

“FinishDate”

FinishDateFieldName

Duration

A column that contains a task’s duration. You can use either Duration or Finish Date.

Empty

DurationFieldName

Text

A caption displayed next to a task in the chart. Note that this column does not have a default name. You must specify it to display task captions in the chart.

Empty

TextFieldName

Tooltip Text

A column that contains a task’s caption in tooltips. Note that this column does not have a default name. You must specify it to display task captions in tooltips.

Empty

InteractionTooltipTextFieldName

Progress

A column that contains a task’s completion percentage.

“Progress”

ProgressFieldName

Baseline Start Date

A column that contains a baseline’s start date.

“BaselineStartDate”

BaselineStartDateFieldName

Baseline Finish Date

A column that contains a baseline’s finish date. You can use either Baseline Finish Date or Baseline Duration.

“BaselineFinishDate”

BaselineFinishDateFieldName

Baseline Duration

A column that contains a baseline’s duration. You can use either Baseline Duration or Baseline Finish Date.

Empty

BaselineDurationFieldName

Key

A column that contains a node’s unique identifier. Use this identifier to specify predecessors.

“ID”

KeyFieldName

Predecessors

A column that contains a task’s predecessors. The column should contain predecessor keys separated by space, comma, or semicolon (‘ ‘, ‘,’ ‘;’). This column allows you to specify finish-to-start dependencies only. Also, note that you cannot specify a time lag between dependent tasks.

“Predecessors”

PredecessorsFieldName

See Also