Skip to content

Commit 632a910

Browse files
925962 - Update Gantt Example codes.
1 parent 3264770 commit 632a910

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

wpf/Gantt/data-binding.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,7 @@ The following code illustrates how to bind the Task Details to the Gantt Control
2525

2626
{% highlight xaml %}
2727

28-
<syncfusion:GanttControl x:Name="ganttControl"
29-
ItemsSource="{Binding TaskDetails}">
30-
<syncfusion:GanttControl.TaskAttributeMapping>
31-
<syncfusion:TaskAttributeMapping TaskIdMapping="ID"
32-
TaskNameMapping="Name"
33-
StartDateMapping="StartDate"
34-
ChildMapping="ChildCollection"
35-
FinishDateMapping="EndDate"
36-
DurationMapping="Duration"
37-
ProgressMapping="Progress"/>
38-
</syncfusion:GanttControl.TaskAttributeMapping>
39-
<syncfusion:GanttControl.DataContext>
40-
<local:ViewModel/>
41-
</syncfusion:GanttControl.DataContext>
28+
<syncfusion:GanttControl x:Name="ganttControl">
4229
</syncfusion:GanttControl>
4330

4431
{% endhighlight %}
@@ -49,15 +36,17 @@ this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
4936

5037
// Task attribute mapping
5138
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
52-
taskAttributeMapping.TaskIdMapping = "ID";
53-
taskAttributeMapping.TaskNameMapping = "Name";
39+
taskAttributeMapping.TaskIdMapping = "TaskId";
40+
taskAttributeMapping.TaskNameMapping = "TaskName";
5441
taskAttributeMapping.StartDateMapping = "StartDate";
55-
taskAttributeMapping.ChildMapping = "ChildCollection";
56-
taskAttributeMapping.FinishDateMapping = "EndDate";
42+
taskAttributeMapping.ChildMapping = "Child";
43+
taskAttributeMapping.FinishDateMapping = "FinishDate";
5744
taskAttributeMapping.DurationMapping = "Duration";
5845
taskAttributeMapping.ProgressMapping = "Progress";
5946
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
6047

48+
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
49+
6150
{% endhighlight %}
6251

6352
{% highlight c# tabtitle="ViewModel.cs" %}

0 commit comments

Comments
 (0)