Bind to Data
- 2 minutes to read
You can bind the GanttControl to a collection of data items that represent tasks.
Note
The GanttControl does not fully support DataTable sources. The control displays data from such sources with limitations (for example, you cannot move and drag tasks).
You should assign your data objects to the ItemsSource collection and specify mappings to bind task properties (StartDate, EndDate, etc.) to your data source fields.
Retrieve Tasks
The GanttControl can retrieve tasks from the following sources:
-
The GanttControl supports binding to hierarchical sources whose data items provide link to their children.
-
You can bind the GanttControl to a plain list of data items. To define the task hierarchy, use mappings (Id and ParentId).
Built-in data types
We provide built-in data objects (GanttTask, GanttPredecessorLink) for those who do not already have types for Gantt elements. You can assign a collection of these objects to the GanttControl.ItemsSource property without mapping properties to data source fields.
Refer to the getting started tutorial for more information on how to bind the GanttControl to a collection of built-in data objects.
Retrieve Task Relationships
You can store task dependencies in the following ways:
- in a separate collection where an element contains a successor-predecessor pair.
- in the task objects that contain information about their predecessors.
Refer to Task Dependencies for more information.
Retrieve Resources
Use the GanttView.ResourcesSource property to bind the GanttControl to a source with resources.
After you bind the GanttControl to resources, assign these resources to tasks. Your data source can store resource dependencies in the following ways:
- in a separate collection where an element contains a task-resource pair.
- in task objects that contain information about their resources.
Refer to Resources for more information.