Skip to content

Commit 8613451

Browse files
Update Example code
1 parent 3b82f73 commit 8613451

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

wpf/Gantt/data-binding.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ The following code illustrates how to bind the Task Details to the Gantt Control
2626
{% highlight xaml %}
2727

2828
<syncfusion:GanttControl x:Name="ganttControl">
29+
ItemsSource="{Binding TaskDetails}">
30+
<syncfusion:GanttControl.TaskAttributeMapping>
31+
<syncfusion:TaskAttributeMapping TaskIdMapping="TaskId"
32+
TaskNameMapping="TaskName"
33+
StartDateMapping="StartDate"
34+
ChildMapping="Child"
35+
FinishDateMapping="FinishDate"
36+
DurationMapping="Duration"
37+
ProgressMapping="Progress"/>
38+
</syncfusion:GanttControl.TaskAttributeMapping>
39+
<syncfusion:GanttControl.DataContext>
40+
<local:ViewModel/>
41+
</syncfusion:GanttControl.DataContext>
2942
</syncfusion:GanttControl>
3043

3144
{% endhighlight %}
@@ -144,7 +157,22 @@ The following code illustrate how to map the properties using the [TaskAttribute
144157
{% tabs %}
145158
{% highlight xaml %}
146159

147-
<syncfusion:GanttControl x:Name="ganttControl">
160+
<syncfusion:GanttControl x:Name="ganttControl"
161+
ItemsSource="{Binding TaskDetails}">
162+
<syncfusion:GanttControl.TaskAttributeMapping>
163+
<syncfusion:TaskAttributeMapping TaskIdMapping="TaskId"
164+
TaskNameMapping="Name"
165+
StartDateMapping="StartDate"
166+
ChildMapping="Child"
167+
FinishDateMapping="FinishDate"
168+
DurationMapping="Duration"
169+
ProgressMapping="Progress"
170+
PredecessorMapping="Predecessor"
171+
ResourceInfoMapping="Resources"/>
172+
</syncfusion:GanttControl.TaskAttributeMapping>
173+
<syncfusion:GanttControl.DataContext>
174+
<local:ViewModel/>
175+
</syncfusion:GanttControl.DataContext>
148176
</syncfusion:GanttControl>
149177

150178
{% endhighlight %}
@@ -159,6 +187,8 @@ taskAttributeMapping.ChildMapping = "Child";
159187
taskAttributeMapping.FinishDateMapping = "FinishDate";
160188
taskAttributeMapping.DurationMapping = "Duration";
161189
taskAttributeMapping.ProgressMapping = "Progress";
190+
taskAttributeMapping.PredecessorMapping = "Predecessor";
191+
taskAttributeMapping.ResourceInfoMapping = "Resources";
162192
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
163193

164194
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;

0 commit comments

Comments
 (0)