Skip to content

Commit 3b82f73

Browse files
Update Gantt Control Data binding document.
1 parent 632a910 commit 3b82f73

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

wpf/Gantt/data-binding.md

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ The following code illustrates how to bind the Task Details to the Gantt Control
3232

3333
{% highlight c# %}
3434

35-
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
36-
3735
// Task attribute mapping
3836
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
3937
taskAttributeMapping.TaskIdMapping = "TaskId";
@@ -146,42 +144,25 @@ The following code illustrate how to map the properties using the [TaskAttribute
146144
{% tabs %}
147145
{% highlight xaml %}
148146

149-
<syncfusion:GanttControl x:Name="ganttControl"
150-
ItemsSource="{Binding TaskDetails}">
151-
<syncfusion:GanttControl.TaskAttributeMapping>
152-
<syncfusion:TaskAttributeMapping TaskIdMapping="ID"
153-
TaskNameMapping="Name"
154-
StartDateMapping="StartDate"
155-
ChildMapping="ChildCollection"
156-
FinishDateMapping="EndDate"
157-
DurationMapping="Duration"
158-
ProgressMapping="Progress"
159-
PredecessorMapping="Predecessor"
160-
ResourceInfoMapping="Resource"/>
161-
</syncfusion:GanttControl.TaskAttributeMapping>
162-
<syncfusion:GanttControl.DataContext>
163-
<local:ViewModel/>
164-
</syncfusion:GanttControl.DataContext>
147+
<syncfusion:GanttControl x:Name="ganttControl">
165148
</syncfusion:GanttControl>
166149

167150
{% endhighlight %}
168151
{% highlight c# %}
169152

170-
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
171-
172153
// Task attribute mapping
173154
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
174-
taskAttributeMapping.TaskIdMapping = "ID";
175-
taskAttributeMapping.TaskNameMapping = "Name";
155+
taskAttributeMapping.TaskIdMapping = "TaskId";
156+
taskAttributeMapping.TaskNameMapping = "TaskName";
176157
taskAttributeMapping.StartDateMapping = "StartDate";
177-
taskAttributeMapping.ChildMapping = "ChildCollection";
178-
taskAttributeMapping.FinishDateMapping = "EndDate";
158+
taskAttributeMapping.ChildMapping = "Child";
159+
taskAttributeMapping.FinishDateMapping = "FinishDate";
179160
taskAttributeMapping.DurationMapping = "Duration";
180161
taskAttributeMapping.ProgressMapping = "Progress";
181-
taskAttributeMapping.PredecessorMapping = "Predecessor";
182-
taskAttributeMapping.ResourceInfoMapping = "Resource";
183162
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
184163

164+
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
165+
185166
{% endhighlight %}
186167
{% endtabs %}
187168

@@ -211,8 +192,6 @@ The following code illustrates how to bind the external source to Gantt control:
211192
{% endhighlight %}
212193
{% highlight c# %}
213194

214-
this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
215-
216195
// Task attribute mapping
217196
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
218197
taskAttributeMapping.TaskIdMapping = "ID";
@@ -226,6 +205,8 @@ taskAttributeMapping.PredecessorMapping = "Predecessor";
226205
taskAttributeMapping.ResourceInfoMapping = "Resource";
227206
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
228207

208+
this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
209+
229210
{% endhighlight %}
230211
{% highlight c# tabtitle="Task.cs" %}
231212

0 commit comments

Comments
 (0)