diff --git a/wpf/Gantt/Custom-Node-Style_images/Custom-Node-Style_img1.png b/wpf/Gantt/Custom-Node-Style_images/Custom-Node-Style_img1.png
deleted file mode 100644
index 8ad4767720..0000000000
Binary files a/wpf/Gantt/Custom-Node-Style_images/Custom-Node-Style_img1.png and /dev/null differ
diff --git a/wpf/Gantt/Custom-Node-Style_images/Custom-Node-Style_img2.png b/wpf/Gantt/Custom-Node-Style_images/Custom-Node-Style_img2.png
deleted file mode 100644
index 99bd943d99..0000000000
Binary files a/wpf/Gantt/Custom-Node-Style_images/Custom-Node-Style_img2.png and /dev/null differ
diff --git a/wpf/Gantt/Custom-Node-Style_images/gantt-custom-node-style-with-gradient.png b/wpf/Gantt/Custom-Node-Style_images/gantt-custom-node-style-with-gradient.png
new file mode 100644
index 0000000000..eb8f581732
Binary files /dev/null and b/wpf/Gantt/Custom-Node-Style_images/gantt-custom-node-style-with-gradient.png differ
diff --git a/wpf/Gantt/Custom-Node-Style_images/gantt-custom-node-style.png b/wpf/Gantt/Custom-Node-Style_images/gantt-custom-node-style.png
new file mode 100644
index 0000000000..4337836d9b
Binary files /dev/null and b/wpf/Gantt/Custom-Node-Style_images/gantt-custom-node-style.png differ
diff --git a/wpf/Gantt/DateTime-Indicator-Customization_images/DateTime-Indicator-Customization_img1.png b/wpf/Gantt/DateTime-Indicator-Customization_images/DateTime-Indicator-Customization_img1.png
deleted file mode 100644
index 3e453bce68..0000000000
Binary files a/wpf/Gantt/DateTime-Indicator-Customization_images/DateTime-Indicator-Customization_img1.png and /dev/null differ
diff --git a/wpf/Gantt/DateTime-Indicator-Customization_images/gantt-control-datetime-indicator-customization.png b/wpf/Gantt/DateTime-Indicator-Customization_images/gantt-control-datetime-indicator-customization.png
new file mode 100644
index 0000000000..29a2f7de64
Binary files /dev/null and b/wpf/Gantt/DateTime-Indicator-Customization_images/gantt-control-datetime-indicator-customization.png differ
diff --git a/wpf/Gantt/Flow-Direction-Images/Right-To-Left.png b/wpf/Gantt/Flow-Direction-Images/Right-To-Left.png
deleted file mode 100644
index d8955bd3d3..0000000000
Binary files a/wpf/Gantt/Flow-Direction-Images/Right-To-Left.png and /dev/null differ
diff --git a/wpf/Gantt/Flow-Direction-Images/gantt-control-flow-direction-right-to-left.png b/wpf/Gantt/Flow-Direction-Images/gantt-control-flow-direction-right-to-left.png
new file mode 100644
index 0000000000..25195253fa
Binary files /dev/null and b/wpf/Gantt/Flow-Direction-Images/gantt-control-flow-direction-right-to-left.png differ
diff --git a/wpf/Gantt/Highlighting-Tasks_images/Highlighting-Tasks_img1.png b/wpf/Gantt/Highlighting-Tasks_images/Highlighting-Tasks_img1.png
deleted file mode 100644
index 5d2783188c..0000000000
Binary files a/wpf/Gantt/Highlighting-Tasks_images/Highlighting-Tasks_img1.png and /dev/null differ
diff --git a/wpf/Gantt/Highlighting-Tasks_images/gantt-control-highlighting-tasks.png b/wpf/Gantt/Highlighting-Tasks_images/gantt-control-highlighting-tasks.png
new file mode 100644
index 0000000000..e89a3d21e2
Binary files /dev/null and b/wpf/Gantt/Highlighting-Tasks_images/gantt-control-highlighting-tasks.png differ
diff --git a/wpf/Gantt/Import-and-Export-Support_images/Import-and-Export-Support_img1.png b/wpf/Gantt/Import-and-Export-Support_images/Import-and-Export-Support_img1.png
deleted file mode 100644
index 56a7d7b672..0000000000
Binary files a/wpf/Gantt/Import-and-Export-Support_images/Import-and-Export-Support_img1.png and /dev/null differ
diff --git a/wpf/Gantt/Import-and-Export-Support_images/gantt-import-and-export-support.png b/wpf/Gantt/Import-and-Export-Support_images/gantt-import-and-export-support.png
new file mode 100644
index 0000000000..f1a4896a9b
Binary files /dev/null and b/wpf/Gantt/Import-and-Export-Support_images/gantt-import-and-export-support.png differ
diff --git a/wpf/Gantt/Localization_images/FinalOutput.png b/wpf/Gantt/Localization_images/FinalOutput.png
deleted file mode 100644
index cc524da057..0000000000
Binary files a/wpf/Gantt/Localization_images/FinalOutput.png and /dev/null differ
diff --git a/wpf/Gantt/Localization_images/localization-in-wpf-gantt-control.png b/wpf/Gantt/Localization_images/localization-in-wpf-gantt-control.png
new file mode 100644
index 0000000000..0d7c80f525
Binary files /dev/null and b/wpf/Gantt/Localization_images/localization-in-wpf-gantt-control.png differ
diff --git a/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/Resource-View-Gantt-Inline-Items_img1.png b/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/Resource-View-Gantt-Inline-Items_img1.png
deleted file mode 100644
index 75f2879e23..0000000000
Binary files a/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/Resource-View-Gantt-Inline-Items_img1.png and /dev/null differ
diff --git a/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/Resource-View-Gantt-Inline-Items_img2.png b/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/Resource-View-Gantt-Inline-Items_img2.png
deleted file mode 100644
index 7242d1e4e8..0000000000
Binary files a/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/Resource-View-Gantt-Inline-Items_img2.png and /dev/null differ
diff --git a/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/resource-view-gantt-inline-datetime-items.png b/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/resource-view-gantt-inline-datetime-items.png
new file mode 100644
index 0000000000..ae2af645b3
Binary files /dev/null and b/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/resource-view-gantt-inline-datetime-items.png differ
diff --git a/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/resource-view-gantt-inline-items.png b/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/resource-view-gantt-inline-items.png
new file mode 100644
index 0000000000..5f952f7f7b
Binary files /dev/null and b/wpf/Gantt/Resource-View-Gantt-Inline-Items_images/resource-view-gantt-inline-items.png differ
diff --git a/wpf/Gantt/Strip-Lines_images/Strip-Lines_absolute.png b/wpf/Gantt/Strip-Lines_images/Strip-Lines_absolute.png
deleted file mode 100644
index 76d6070a8b..0000000000
Binary files a/wpf/Gantt/Strip-Lines_images/Strip-Lines_absolute.png and /dev/null differ
diff --git a/wpf/Gantt/Strip-Lines_images/Strip-Lines_img1.png b/wpf/Gantt/Strip-Lines_images/Strip-Lines_img1.png
deleted file mode 100644
index db2359405b..0000000000
Binary files a/wpf/Gantt/Strip-Lines_images/Strip-Lines_img1.png and /dev/null differ
diff --git a/wpf/Gantt/Strip-Lines_images/absolute-striplines-in-gantt-control.png b/wpf/Gantt/Strip-Lines_images/absolute-striplines-in-gantt-control.png
new file mode 100644
index 0000000000..88db0c92e3
Binary files /dev/null and b/wpf/Gantt/Strip-Lines_images/absolute-striplines-in-gantt-control.png differ
diff --git a/wpf/Gantt/Strip-Lines_images/regular-striplines-in-gantt-control.png b/wpf/Gantt/Strip-Lines_images/regular-striplines-in-gantt-control.png
new file mode 100644
index 0000000000..d4ba2632cc
Binary files /dev/null and b/wpf/Gantt/Strip-Lines_images/regular-striplines-in-gantt-control.png differ
diff --git a/wpf/Gantt/Zooming_images/Zooming_img1.png b/wpf/Gantt/Zooming_images/Zooming_img1.png
deleted file mode 100644
index 8db67c3ed6..0000000000
Binary files a/wpf/Gantt/Zooming_images/Zooming_img1.png and /dev/null differ
diff --git a/wpf/Gantt/Zooming_images/Zooming_img2.png b/wpf/Gantt/Zooming_images/Zooming_img2.png
deleted file mode 100644
index 0c663b7ac1..0000000000
Binary files a/wpf/Gantt/Zooming_images/Zooming_img2.png and /dev/null differ
diff --git a/wpf/Gantt/Zooming_images/gantt-control-built-in-zooming.png b/wpf/Gantt/Zooming_images/gantt-control-built-in-zooming.png
new file mode 100644
index 0000000000..f47cba5813
Binary files /dev/null and b/wpf/Gantt/Zooming_images/gantt-control-built-in-zooming.png differ
diff --git a/wpf/Gantt/Zooming_images/gantt-control-custom-zooming.png b/wpf/Gantt/Zooming_images/gantt-control-custom-zooming.png
new file mode 100644
index 0000000000..14085d56ea
Binary files /dev/null and b/wpf/Gantt/Zooming_images/gantt-control-custom-zooming.png differ
diff --git a/wpf/Gantt/custom-node-style.md b/wpf/Gantt/custom-node-style.md
index c8ddcf0b97..b2e6de0076 100644
--- a/wpf/Gantt/custom-node-style.md
+++ b/wpf/Gantt/custom-node-style.md
@@ -50,252 +50,404 @@ Milestone
MileStone |
-
-The following code illustrates how to define style:
-
-{% capture codesnippet1 %}
+{% tabs %}
{% highlight xaml %}
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-{% endhighlight %}
-{% endcapture %}
-{{ codesnippet1 | OrderList_Indent_Level_1 }}
-
-2. Add the style as a resource to the Gantt control in your application.
-
-The following code illustrates how to add the styles to the application:
-
-{% capture codesnippet2 %}
-{% highlight xaml %}
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
{% endhighlight %}
-{% endcapture %}
-{{ codesnippet2 | OrderList_Indent_Level_1 }}
-
-
-
+{% highlight c# %}
-_Custom Node Style_
+ this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
+// Task attribute mapping
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "TaskId";
+taskAttributeMapping.TaskNameMapping = "TaskName";
+taskAttributeMapping.StartDateMapping = "StartDate";
+taskAttributeMapping.ChildMapping = "Child";
+taskAttributeMapping.FinishDateMapping = "FinishDate";
+taskAttributeMapping.DurationMapping = "Duration";
+taskAttributeMapping.MileStoneMapping = "IsMileStone";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
+{% endhighlight %}
-
+{% highlight c# tabtitle="ViewModel.cs" %}
+
+ public class ViewModel
+ {
+ ///
+ /// Holds the task collections.
+ ///
+ private ObservableCollection taskCollections;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ViewModel()
+ {
+ this.taskCollections = GetData();
+ }
+
+ ///
+ /// Gets or sets the appointment item source.
+ ///
+ /// The appointment item source.
+ public ObservableCollection TaskCollection
+ {
+ get
+ {
+ return this.taskCollections;
+ }
+ set
+ {
+ this.taskCollections = value;
+ }
+ }
+
+ ///
+ /// Gets the data.
+ ///
+ /// The task details
+ public ObservableCollection GetData()
+ {
+ var taskDetails = new ObservableCollection();
+
+ taskDetails.Add(new TaskDetails() { TaskId = 1, TaskName = "Analysis/Planning", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 2, TaskName = "Identify Components to be Localized", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 3, TaskName = "Ensure file localizability", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 4, TaskName = "Identify tools", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 5, TaskName = "Test tools", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 1), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 6, TaskName = "Develop delivery timeline", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 8, 1), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 7, TaskName = "Analysis Complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 10), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 8, TaskName = "Production", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 9, TaskName = "Software Components", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 10, TaskName = "Localization Component - User Interface", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 11, TaskName = "User Assistance Components", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 12, TaskName = "Software components complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 13, TaskName = "Quality Assurance", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 12), Progress = 40d, });
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 14, TaskName = "Review project information", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 15), Progress = 20d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 15, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 8), Progress = 20d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 16, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 17, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 18, TaskName = "Beta Testing", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 19, TaskName = "Disseminate completed product", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 20, TaskName = "Obtain feedback", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 21, TaskName = "Modify", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 22, TaskName = "Test", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 23, TaskName = "Complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 24, TaskName = "Post-Project Review", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 18), Progress = 40d, });
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 25, TaskName = "Finalize cost analysis", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 26, TaskName = "Analyze performance", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 27, TaskName = "Archive files", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 28, TaskName = "Document lessons learned", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 29, TaskName = "Distribute to team members", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 30, TaskName = "Post-project review complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+
+ taskDetails[0].Resources = new ObservableCollection() { new Resource { ID = 1, Name = "John" }, new Resource { ID = 2, Name = "Neil" } };
+ taskDetails[0].Child[3].Resources = new ObservableCollection() { new Resource() { ID = 3, Name = "Peter" } };
+ taskDetails[1].Resources = new ObservableCollection() { new Resource() { ID = 4, Name = "David" } };
+
+ taskDetails[0].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 2, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[1].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 9, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 10, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 7, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[2].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+
+ taskDetails[3].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[4].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 25, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 28, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 30, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[4].Predecessor.Add(new Predecessor() { GanttTaskIndex = 27, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ return taskDetails;
+ }
+}
+
+{% endhighlight %}
+{% endtabs %}
+
+
+_Custom Node Style_
+
Custom Node Style
{:.caption}
diff --git a/wpf/Gantt/custom-schedule.md b/wpf/Gantt/custom-schedule.md
index 59978a1cda..c9ee4eee95 100644
--- a/wpf/Gantt/custom-schedule.md
+++ b/wpf/Gantt/custom-schedule.md
@@ -132,68 +132,610 @@ To Add CustomNumeric Schedule to an application:
2. Bind the GanttScheduleRowInfo collection to the CustomScheduleSource property of the Gantt.
The following code illustrates Adding Custom Schedule to an Application:
-{% highlight xaml %}
-
-
-
-
-
-
+{% tabs %}
+{% highlight xaml %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% endhighlight %}
{% highlight c# %}
-// Assigning the custom schedule Items Source
-
-this.Gantt.CustomScheduleSource = this.GetInfo();
+this.ganttControl.ItemsSource = new ViewModel().TaskCollections;
+this.ganttControl.ScheduleType= ScheduleType.CustomNumeric;
+this.ganttControl.UseAutoUpdateHierarchy = false;
+
+// Task attribute mapping
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "Id";
+taskAttributeMapping.TaskNameMapping = "Name";
+taskAttributeMapping.StartDateMapping = "Start";
+taskAttributeMapping.ChildMapping = "ChildTask";
+taskAttributeMapping.FinishDateMapping = "End";
+taskAttributeMapping.ProgressMapping = "Complete";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
-/// Gets the Numeric Schedule Items Info
+{% endhighlight %}
-private ObservableCollection GetInfo()
+{% highlight c# tabtitle="Model.cs" %}
+public class TopCountries : NotificationObject
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public TopCountries()
+ {
+ this.ChildTopCountries = new ObservableCollection();
+ }
+
+ ///
+ /// Holds the id value.
+ ///
+ private int id;
+
+ ///
+ /// Holds the name value.
+ ///
+ private string name;
+
+ ///
+ /// Holds the rank value.
+ ///
+ private int _rank;
+
+ ///
+ /// Holds the child countries value.
+ ///
+ private ObservableCollection childTopCountries;
+
+ ///
+ /// Holds the end value.
+ ///
+ private double _end;
+
+ ///
+ /// Holds the complete value.
+ ///
+ private int _complete = 100;
+
+ ///
+ /// Holds the start value.
+ ///
+ private double _start;
+
+ ///
+ /// Gets or sets the start.
+ ///
+ ///
+ /// The start.
+ ///
+ public double Start
+ {
+ get
+ {
+ return _start;
+ }
+ set
+ {
+ // if the TopCountries is parent TopCountries it selects the minimum start date of the childTopCountriess
+ if (childTopCountries != null && childTopCountries.Count >= 1)
+ {
+ if (this._start != value)
+ {
+ this._start = childTopCountries.Min(s => s.Start);
+ }
+ }
+ else
+ {
+ this._start = value;
+ }
+ RaisePropertyChanged("Start");
+ }
+ }
+
+ ///
+ /// Gets or sets the end.
+ ///
+ ///
+ /// The end.
+ ///
+ public double End
+ {
+ get
+ {
+ return this._end;
+ }
+ set
+ {
+ // if the TopCountries is parent TopCountries it selects the maximum end date of the childTopCountriess
+ if (this.childTopCountries != null && this.childTopCountries.Count >= 1)
+ {
+ if (this._end != value)
+ {
+ this._end = childTopCountries.Max(s => s.End);
+ }
+ }
+ else
+ {
+ this._end = value;
+ }
+ RaisePropertyChanged("End");
+ }
+ }
+
+
+ ///
+ /// Gets or sets the complete.
+ ///
+ ///
+ /// The complete.
+ ///
+ public int Rank
+ {
+ get
+ {
+ return this._rank;
+ }
+ set
+ {
+ this._rank = value;
+ RaisePropertyChanged("Rank");
+ }
+ }
+
+ ///
+ /// Gets or sets the complete.
+ ///
+ ///
+ /// The complete.
+ ///
+ public int Complete
+ {
+ get { return this._complete; }
+ set { this._complete = value; }
+ }
-// Creating a new collection
+ ///
+ /// Gets or sets the name.
+ ///
+ ///
+ /// The name.
+ ///
+ public string Name
+ {
+ get
+ {
+ return this.name;
+ }
+ set
+ {
+ this.name = value;
+ RaisePropertyChanged("Name");
+ }
+ }
-ObservableCollection RowInfo = new
+ ///
+ /// Gets or sets the id.
+ ///
+ ///
+ /// The id.
+ ///
+ public int Id
+ {
+ get
+ {
+ return this.id;
+ }
+ set
+ {
+ this.id = value;
+ RaisePropertyChanged("Id");
+ }
+ }
- ObservableCollection();
+ #region ChildTopCountries Collection
-// Defining the top most row of the schedule
+ ///
+ /// Gets or sets the child top countries.
+ ///
+ /// The child top countries.
+ public ObservableCollection ChildTopCountries
+ {
+ get
+ {
+ if (this.childTopCountries == null)
+ {
+ this.childTopCountries = new ObservableCollection();
+ /// Collection changed of child TopCountriess are hooked to listen and refresh the parent node based on the changes made in Child.
+ this.childTopCountries.CollectionChanged += ChildNodesCollectionChanged;
+ }
+ return this.childTopCountries;
+ }
+ set
+ {
+ this.childTopCountries = value;
+ ///Collection changed of child TopCountriess are hooked to listen and refresh the parent node based on the changes made in Child.
+
+ this.childTopCountries.CollectionChanged += ChildNodesCollectionChanged;
+
+ if (value.Count > 0)
+ {
+ this.childTopCountries.ToList().ForEach(n =>
+ {
+ /// To listen the changes occuring in child TopCountries.
+ n.PropertyChanged += ChildNodePropertyChanged;
+
+ });
+ UpdateData();
+ }
+ RaisePropertyChanged("ChildTopCountries");
+ }
+ }
-RowInfo.Add(new GanttScheduleRowInfo() { CellsPerUnit = 3 });
+ ///
+ /// The following does the calculations to update the Parent TopCountries, when child collection property changes.
+ ///
+ /// The source
+ /// Property changed event args
+ void ChildNodePropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName != null)
+ if (e.PropertyName == "Start" || e.PropertyName == "End")
+ {
+ UpdateData();
+ }
+ }
-// Defining the consecutive rows of the schedule
+ ///
+ /// Updates the data.
+ ///
+ private void UpdateData()
+ {
+ /// Updating the start and end based on the chagne occur in the date of child TopCountries
+ if (this.childTopCountries == null || this.childTopCountries.Count == 0)
+ {
+ return;
+ }
-RowInfo.Add(new GanttScheduleRowInfo() { CellsPerUnit = 2 });
+ Start = this.childTopCountries.Select(s => s.Start).Min();
+ End = this.childTopCountries.Select(s => s.End).Max();
+ }
-RowInfo.Add(new GanttScheduleRowInfo() { CellsPerUnit = 5 });
+ ///
+ /// Childs the nodes collection changed.
+ ///
+ /// The sender.
+ /// The instance containing the event data.
+ public void ChildNodesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+ {
+ if (e.Action == NotifyCollectionChangedAction.Add)
+ {
+ foreach (TopCountries node in e.NewItems)
+ {
+ node.PropertyChanged += ChildNodePropertyChanged;
+ }
+ }
+ else
+ {
+ foreach (TopCountries node in e.OldItems)
+ node.PropertyChanged -= ChildNodePropertyChanged;
+ }
+ UpdateData();
+ }
-// Defining the bottom most row of the schedule
+ #endregion
-// Here we are setting the cell width in pixels
+ internal void Dispose()
+ {
+ ChildTopCountries.CollectionChanged -= ChildNodesCollectionChanged;
-RowInfo.Add(new GanttScheduleRowInfo() { PixelsPerUnit = 30d });
+ if (ChildTopCountries.Count > 0)
+ {
+ ChildTopCountries.ToList().ForEach(node =>
+ {
+ node.PropertyChanged -= ChildNodePropertyChanged;
+ });
+ }
+ }
+}
-return RowInfo;
+{% endhighlight %}
-}
+{% highlight c# tabtitle="ViewModel.cs" %}
+
+ public class ViewModel
+ {
+ ///
+ /// Holds the custom schedule information.
+ ///
+ private ObservableCollection _customScheduleInfo;
+
+ ///
+ /// Holds the top countries collections.
+ ///
+ private ObservableCollection _topCountriesCollection;
+
+ public ViewModel()
+ {
+ this.CreateCountryCollection();
+ this._topCountriesCollection = GetData();
+ this._customScheduleInfo = GetCustomScheduleInfo();
+ }
+
+ ///
+ /// Collection which is used to store the CountryNamesWith their Flags
+ ///
+ internal static Dictionary countryFlagDetails = new Dictionary();
+
+ ///
+ /// Gets or sets the custom schedule info.
+ ///
+ /// The custom schedule info.
+ public ObservableCollection CustomScheduleInfo
+ {
+ get
+ {
+ return this._customScheduleInfo;
+ }
+ set
+ {
+ this._customScheduleInfo = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the appointment item source.
+ ///
+ /// The appointment item source.
+ public ObservableCollection TopCountriesCollection
+ {
+ get
+ {
+ return this._topCountriesCollection;
+ }
+ set
+ {
+ this._topCountriesCollection = value;
+ }
+ }
+
+
+ ///
+ /// Gets the Numeric Schedule Items Info
+ ///
+ ///
+ private ObservableCollection GetCustomScheduleInfo()
+ {
+ ObservableCollection RowInfo = new ObservableCollection();
+ RowInfo.Add(new GanttScheduleRowInfo() { CellsPerUnit = 5 });
+ RowInfo.Add(new GanttScheduleRowInfo() { CellsPerUnit = 2, PixelsPerUnit = 30d });
+ return RowInfo;
+ }
+
+ ///
+ /// Gets the data.
+ ///
+ /// The task details
+ public ObservableCollection GetData()
+ {
+ var taskDetails = new ObservableCollection();
+
+ taskDetails.Add(new TopCountries() { Id = 1, Name = "Afghanistan", Start = 0, End = 8.227, Rank = 17 });
+ taskDetails.Add(new TopCountries() { Id = 2, Name = "Argentina", Start = 0, End = 9.161, Rank = 8 });
+ taskDetails.Add(new TopCountries() { Id = 3, Name = "Belarus", Start = 0, End = 7.6, Rank = 27 });
+ taskDetails.Add(new TopCountries() { Id = 4, Name = "Botswana", Start = 0, End = 8.562, Rank = 13 });
+ taskDetails.Add(new TopCountries() { Id = 5, Name = "Brazil", Start = 0, End = 7.49, Rank = 31 });
+ taskDetails.Add(new TopCountries() { Id = 6, Name = "Democratic Republic of the Congo", Start = 0, End = 7.245, Rank = 32 });
+ taskDetails.Add(new TopCountries() { Id = 7, Name = "Dominican Republic", Start = 0, End = 7.751, Rank = 23 });
+ taskDetails.Add((new TopCountries() { Id = 8, Name = "Ethiopia", Start = 0, End = 8.008, Rank = 20 }));
+ taskDetails.Add((new TopCountries() { Id = 9, Name = "India", Start = 0, End = 11.1, Rank = 4 }));
+ taskDetails.Add((new TopCountries() { Id = 10, Name = "Laos", Start = 0, End = 7.747, Rank = 24 }));
+ taskDetails.Add((new TopCountries() { Id = 11, Name = "Lebanon", Start = 0, End = 7.5, Rank = 30, }));
+ taskDetails.Add((new TopCountries() { Id = 12, Name = "Malaysia", Start = 0, End = 7.156, Rank = 33 }));
+ taskDetails.Add(new TopCountries() { Id = 13, Name = "Maldives", Start = 0, End = 7.969, Rank = 21, });
+ taskDetails.Add((new TopCountries() { Id = 14, Name = "Mozambique", Start = 0, End = 7.009, Rank = 35 }));
+ taskDetails.Add((new TopCountries() { Id = 15, Name = "Niger", Start = 0, End = 7.53, Rank = 28, }));
+ taskDetails.Add((new TopCountries() { Id = 16, Name = "Nigeria", Start = 0, End = 8.394, Rank = 16, }));
+ taskDetails.Add((new TopCountries() { Id = 17, Name = "Panama", Start = 0, End = 7.505, Rank = 29, }));
+ taskDetails.Add(new TopCountries() { Id = 18, Name = "Papua New Guinea", Start = 0, End = 7.03, Rank = 34 });
+ taskDetails.Add((new TopCountries() { Id = 19, Name = "Paraguay", Start = 0, End = 14.40, Rank = 3 }));
+ taskDetails.Add((new TopCountries() { Id = 20, Name = "People's Republic of China", Start = 0, End = 10.3, Rank = 6 }));
+ taskDetails.Add((new TopCountries() { Id = 21, Name = "Peru", Start = 0, End = 8.795, Rank = 12 }));
+ taskDetails.Add((new TopCountries() { Id = 22, Name = "Philippines", Start = 0, End = 7.6, Rank = 26 }));
+ taskDetails.Add((new TopCountries() { Id = 23, Name = "Qatar", Start = 0, End = 16.272, Rank = 1 }));
+ taskDetails.Add(new TopCountries() { Id = 24, Name = "Republic of China(Taiwan)", Start = 0, End = 10.8, Rank = 6 });
+ taskDetails.Add((new TopCountries() { Id = 25, Name = "Republic of the Congo", Start = 0, End = 9.09, Rank = 10 }));
+ taskDetails.Add((new TopCountries() { Id = 26, Name = "Singapore", Start = 0, End = 15.27, Rank = 2 }));
+ taskDetails.Add((new TopCountries() { Id = 27, Name = "Sri Lanka", Start = 0, End = 9.134, Rank = 9 }));
+ taskDetails.Add((new TopCountries() { Id = 28, Name = "Thailand", Start = 0, End = 7.803, Rank = 22 }));
+ taskDetails.Add(new TopCountries() { Id = 29, Name = "Turkey", Start = 0, End = 8.2, Rank = 18 });
+ taskDetails.Add((new TopCountries() { Id = 30, Name = "Turkmenistan", Start = 0, End = 9.222, Rank = 7 }));
+ taskDetails.Add((new TopCountries() { Id = 31, Name = "Uruguay", Start = 0, End = 8.468, Rank = 15 }));
+ taskDetails.Add((new TopCountries() { Id = 32, Name = "Uzbekistan", Start = 0, End = 8.5, Rank = 14 }));
+ taskDetails.Add((new TopCountries() { Id = 33, Name = "Yemen", Start = 0, End = 8.016, Rank = 19 }));
+ taskDetails.Add(new TopCountries() { Id = 34, Name = "Zambia", Start = 0, End = 7.601, Rank = 25 });
+ taskDetails.Add((new TopCountries() { Id = 35, Name = "Zimbabwe", Start = 0, End = 9.006, Rank = 11 }));
+
+ return taskDetails;
+ }
+
+ #region Image and Country Collection
+
+ ///
+ /// Creates the country collection with the corresponding Image.
+ ///
+ private void CreateCountryCollection()
+ {
+ countryFlagDetails.Add("Afghanistan", "Flag_Afghanistan.png");
+ countryFlagDetails.Add("Argentina", "Flag_Argentina.png");
+ countryFlagDetails.Add("Belarus", "Flag_Belarus.png");
+ countryFlagDetails.Add("Botswana", "Flag_Botswana.png");
+ countryFlagDetails.Add("Brazil", "Flag_Brazil.png");
+ countryFlagDetails.Add("Democratic Republic of the Congo", "Flag_Democratic_Republic_of_the_Congo.png");
+ countryFlagDetails.Add("Dominican Republic", "Flag_Dominican_Republic.png");
+ countryFlagDetails.Add("Ethiopia", "Flag_Ethiopia.png");
+ countryFlagDetails.Add("India", "Flag_India.png");
+ countryFlagDetails.Add("Laos", "Flag_Laos.png");
+ countryFlagDetails.Add("Lebanon", "Flag_Lebanon.png");
+ countryFlagDetails.Add("Malaysia", "Flag_Malaysia.png");
+ countryFlagDetails.Add("Maldives", "Flag_Maldives.png");
+ countryFlagDetails.Add("Mozambique", "Flag_Mozambique.png");
+ countryFlagDetails.Add("Niger", "Flag_Niger.png");
+ countryFlagDetails.Add("Nigeria", "Flag_Nigeria.png");
+ countryFlagDetails.Add("Panama", "Flag_Panama.png");
+ countryFlagDetails.Add("Papua New Guinea", "Flag_Papua_New_Guinea.png");
+ countryFlagDetails.Add("Paraguay", "Flag_Paraguay.png");
+ countryFlagDetails.Add("People's Republic of China", "Flag_People's_Republic_of_China.png");
+ countryFlagDetails.Add("Peru", "Flag_Peru.png");
+ countryFlagDetails.Add("Philippines", "Flag_Philippines.png");
+ countryFlagDetails.Add("Qatar", "Flag_Qatar.png");
+ countryFlagDetails.Add("Republic of China(Taiwan)", "Flag_Republic_of_China.png");
+ countryFlagDetails.Add("Republic of the Congo", "Flag_Republic_of_the_Congo.png");
+ countryFlagDetails.Add("Singapore", "Flag_Singapore.png");
+ countryFlagDetails.Add("Sri Lanka", "Flag_Sri_Lanka.png");
+ countryFlagDetails.Add("Thailand", "Flag_Thailand.png");
+ countryFlagDetails.Add("Turkey", "Flag_Turke.png");
+ countryFlagDetails.Add("Turkmenistan", "Flag_Turkmenistan.png");
+ countryFlagDetails.Add("Uruguay", "Flag_Uruguay.png");
+ countryFlagDetails.Add("Uzbekistan", "Flag_Uzbekistan.png");
+ countryFlagDetails.Add("Yemen", "Flag_Yemen.png");
+ countryFlagDetails.Add("Zambia", "Flag_Zambia.png");
+ countryFlagDetails.Add("Zimbabwe", "Flag_Zimbabwe.png");
+
+ }
+ #endregion
+ }
{% endhighlight %}
+{% endtabs %}
The following image shows Custom Schedule:
-
+
Custom Schedule
{:.caption}
@@ -222,50 +764,62 @@ The following code illustrates this:
{% tabs %}
{% highlight xaml %}
-
-
-
-
-
-
+
+
+
+
+
+
+
+
{% endhighlight %}
+
{% highlight c# %}
-// Assigning the custom schedule Items Source.
+this.ganttControl.ItemsSource = new ViewModel().TaskCollections;
+this.ganttControl.ScheduleType= ScheduleType.CustomDateTime;
+this.ganttControl.ShowChartLines = false;
+this.ganttControl.ShowNonWorkingHoursBackground = false;
+
+/// Task attribute mapping
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "ID";
+taskAttributeMapping.TaskNameMapping = "Name";
+taskAttributeMapping.StartDateMapping = "StartDate";
+taskAttributeMapping.ChildMapping = "ChildCollection";
+taskAttributeMapping.FinishDateMapping = "EndDate";
+taskAttributeMapping.DurationMapping = "Duration";
+taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
-this.Gantt.CustomScheduleSource = this.GetCustomScheduleSource();
+// Assigning the custom schedule Items Source.
+this.ganttControl.CustomScheduleSource = this.GetCustomScheduleSource();
// Hooks the schedule cell created event to customize the schedule cell appearance.
+this.ganttControl.ScheduleCellCreated += this.OnGanttScheduleCellCreated;
-this.Gantt.ScheduleCellCreated += new GanttControl.ScheduleCellCreatedEventHandler(Gantt_ScheduleCellCreated);
-
-// Gets the Custom Schedule Items Info
-
-
+// Gets the Custom Schedule Items Info
public IList GetCustomScheduleSource()
-
{
-
List RowInfo = new List();
// Defining the top most row of the schedule
-
// Here we need the Year Schedule in this row. So we are defining the TimeUnit as years
-
RowInfo.Add(new GanttScheduleRowInfo()
{
TimeUnit = TimeUnit.Years,
@@ -274,11 +828,8 @@ public IList GetCustomScheduleSource()
});
// Defining the bottom most row of the schedule
-
// Here we need to display the three months in a cell so we are defining TimeUnit in months, and cells per Unit as 3
-
// Bottom Most row should consist information about the pixels per Unit, so we define the pixels per unit as 15 (here this is a one month width).
-
RowInfo.Add(new GanttScheduleRowInfo()
{
TimeUnit = TimeUnit.Months,
@@ -287,94 +838,346 @@ public IList GetCustomScheduleSource()
});
return RowInfo;
-
}
/// Handles the Schedule cell Created Event of the Gantt
-void Gantt_ScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args)
-
+private void OnGanttScheduleCellCreated(object sender, ScheduleCellCreatedEventArgs args)
{
-
DateTime currentDate = args.CurrentCell.CellDate;
-
if (args.CurrentCell.CellTimeUnit == TimeUnit.Months)
-
{
-
args.CurrentCell.Foreground = new SolidColorBrush(Colors.White);
-
// Quarter 1 dates contain months below 3 as we are checking the cell date and changing the content of the cell.
-
if (currentDate.Month <= 3)
-
{
-
args.CurrentCell.Content = "Q 1";
-
args.CurrentCell.CellToolTip = "Quarter 1";
-
args.CurrentCell.Background = new SolidColorBrush(Colors.DarkGray);
-
}
// Quarter 2 dates contain months between 4 – 6 as we are checking the cell dates and changing the content of the cell.
-
else if (currentDate.Month > 3 && currentDate.Month <= 6)
-
{
-
args.CurrentCell.Content = "Q 2";
-
args.CurrentCell.CellToolTip = "Quarter 2";
-
args.CurrentCell.Background = new SolidColorBrush(Colors.LightGray);
-
}
// Quarter 3 dates contains months between 6 - 9 as we are checking the cell date and changing the Content of the cell.
-
else if (currentDate.Month > 6 && currentDate.Month <= 9)
+ {
+ args.CurrentCell.Content = "Q 3";
+ args.CurrentCell.CellToolTip = "Quarter 3";
+ args.CurrentCell.Background = new SolidColorBrush(Colors.DarkGray);
+ }
+ // Quarter 4 dates contains months between 9 - 12. So we are checking the cell date and changing the content of the cell.
+ else if (currentDate.Month > 9 && currentDate.Month <= 12)
{
+ args.CurrentCell.Content = "Q 4";
+ args.CurrentCell.CellToolTip = "Quarter 4";
+ args.CurrentCell.Background = new SolidColorBrush(Colors.LightGray);
+ }
+ }
- args.CurrentCell.Content = "Q 3";
+}
- args.CurrentCell.CellToolTip = "Quarter 3";
+{% endhighlight %}
+{% highlight c# tabtitle="Task.cs" %}
- args.CurrentCell.Background = new SolidColorBrush(Colors.DarkGray);
+public class Task : INotifyPropertyChanged
+{
+ ///
+ /// Holds the start date and end date value.
+ ///
+ private DateTime startDate, endDate;
+
+ ///
+ /// Holds the duration value.
+ ///
+ private TimeSpan duration;
+
+ ///
+ /// Holds the progress value.
+ ///
+ private double progress;
+
+ ///
+ /// Holds the id value.
+ ///
+ private int id;
+
+ ///
+ /// Holds the name value.
+ ///
+ private string name;
+
+ ///
+ /// Holds the collection value.
+ ///
+ private ObservableCollection childCollection;
+
+ ///
+ /// Holds the resource value.
+ ///
+ private ObservableCollection resource;
+
+ ///
+ /// Holds the predecessor value.
+ ///
+ private ObservableCollection predecessor;
+
+ public Task()
+ {
+ this.ChildCollection = new ObservableCollection();
+ this.Predecessor = new ObservableCollection();
+ this.Resource = new ObservableCollection();
+ }
+ ///
+ /// Gets or sets the start date.
+ ///
+ public DateTime StartDate
+ {
+ get
+ {
+ return this.startDate;
}
+ set
+ {
+ this.startDate = value;
+ OnPropertyChanged("StartDate");
+ }
+ }
- // Quarter 4 dates contains months between 9 - 12. So we are checking the cell date and changing the content of the cell.
+ ///
+ /// Gets or sets the finish date.
+ ///
+ public DateTime EndDate
+ {
+ get
+ {
+ return this.endDate;
+ }
+ set
+ {
+ this.endDate = value;
+ OnPropertyChanged("EndDate");
+ }
+ }
- else if (currentDate.Month > 9 && currentDate.Month <= 12)
+ ///
+ /// Gets or sets the duration value.
+ ///
+ public TimeSpan Duration
+ {
+ get
+ {
+ return this.duration;
+ }
+ set
+ {
+ this.duration = value;
+ OnPropertyChanged("Duration");
+ }
+ }
+ ///
+ /// Gets or sets the id value.
+ ///
+ public int ID
+ {
+ get
{
+ return this.id;
+ }
+ set
+ {
+ this.id = value;
+ OnPropertyChanged("ID");
+ }
+ }
- args.CurrentCell.Content = "Q 4";
+ ///
+ /// Gets or sets name.
+ ///
+ public string Name
+ {
+ get
+ {
+ return this.name;
+ }
+ set
+ {
+ this.name = value;
+ OnPropertyChanged("Name");
+ }
+ }
- args.CurrentCell.CellToolTip = "Quarter 4";
+ ///
+ /// Gets or sets the progress.
+ ///
+ public double Progress
+ {
+ get
+ {
+ return this.progress;
+ }
+ set
+ {
+ this.progress = value;
+ OnPropertyChanged("Progress");
+ }
+ }
- args.CurrentCell.Background = new SolidColorBrush(Colors.LightGray);
+ ///
+ /// Gets or sets the child collection.
+ ///
+ public ObservableCollection ChildCollection
+ {
+ get
+ {
+ return this.childCollection;
+ }
+ set
+ {
+ this.childCollection = value;
+ OnPropertyChanged("ChildCollection");
+ }
+ }
+ ///
+ /// Gets or sets the resource value.
+ ///
+ public ObservableCollection Resource
+ {
+ get
+ {
+ return this.resource;
}
+ set
+ {
+ this.resource = value;
+ OnPropertyChanged("Resource");
+ }
+ }
+ ///
+ /// Gets or sets the predecessor value.
+ ///
+ public ObservableCollection Predecessor
+ {
+ get
+ {
+ return this.predecessor;
+ }
+ set
+ {
+ this.predecessor = value;
+ OnPropertyChanged("Predecessor");
+ }
}
+ private void OnPropertyChanged(string propName)
+ {
+ if (this.PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propName));
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
}
{% endhighlight %}
-{% endtabs %}
-
+{% highlight c# tabtitle="ViewModel.cs" %}
+
+public class ViewModel
+{
+ ///
+ /// Gets or sets the task collection.
+ ///
+ public ObservableCollection TaskCollection { get; set; }
-The following image shows Custom DateTime Schedule:
+ public ViewModel()
+ {
+ this.TaskCollection = this.GetDataSource();
+ }
+ ///
+ /// Gets the data.
+ ///
+ /// The task details
+ private ObservableCollection GetDataSource()
+ {
+ var taskDetails = new ObservableCollection();
+ taskDetails.Add(new Task() { ID = 1, Name = "Scope", StartDate = new DateTime(2011, 8, 9), EndDate = new DateTime(2012, 6, 20), Progress = 40d });
+ taskDetails[0].ChildCollection.Add((new Task() { ID = 2, Name = "Determine project office scope", StartDate = new DateTime(2011, 8, 9), EndDate = new DateTime(2012, 2, 20), Progress = 20d, }));
+ taskDetails[0].ChildCollection.Add((new Task() { ID = 3, Name = "Justify Project Offfice via business model", StartDate = new DateTime(2011, 11, 6), EndDate = new DateTime(2012, 4, 7), Progress = 20d, }));
+ taskDetails[0].ChildCollection.Add((new Task() { ID = 4, Name = "Secure executive sponsorship", StartDate = new DateTime(2012, 2, 10), EndDate = new DateTime(2012, 6, 14), Progress = 10d, }));
+ taskDetails[0].ChildCollection.Add((new Task() { ID = 5, Name = "Secure Progress", StartDate = new DateTime(2012, 6, 14), EndDate = new DateTime(2012, 9, 14), Progress = 10d }));
+
+ taskDetails.Add(new Task() { ID = 6, Name = "Risk Assessment", StartDate = new DateTime(2012, 7, 15), EndDate = new DateTime(2011, 7, 24) });
+ taskDetails[1].ChildCollection.Add((new Task() { ID = 7, Name = "Perform risk assessment", StartDate = new DateTime(2012, 2, 15), EndDate = new DateTime(2012, 8, 21), Progress = 20d, }));
+ taskDetails[1].ChildCollection.Add((new Task() { ID = 8, Name = "Evaluate risk assessment", StartDate = new DateTime(2012, 5, 21), EndDate = new DateTime(2012, 7, 23), Progress = 20d, }));
+ taskDetails[1].ChildCollection.Add((new Task() { ID = 9, Name = "Prepare contingency plans", StartDate = new DateTime(2012, 8, 21), EndDate = new DateTime(2013, 2, 24), Progress = 20d, }));
+ taskDetails[1].ChildCollection.Add((new Task() { ID = 10, Name = "Risk Assessment Progress", StartDate = new DateTime(2012, 4, 24), EndDate = new DateTime(2012, 9, 24), Progress = 30d }));
+
+ taskDetails.Add(new Task() { ID = 11, Name = "Monitoring", StartDate = new DateTime(2012, 7, 25), EndDate = new DateTime(2012, 8, 6), Duration = new TimeSpan(1, 0, 0, 0) });
+ taskDetails[2].ChildCollection.Add((new Task() { ID = 12, Name = "Prepare Meeting agenda", StartDate = new DateTime(2012, 9, 25), EndDate = new DateTime(2012, 12, 26), Progress = 20d, }));
+ taskDetails[2].ChildCollection.Add((new Task() { ID = 13, Name = "Conduct review meeting", StartDate = new DateTime(2013, 1, 27), EndDate = new DateTime(2013, 7, 30), Progress = 20d, }));
+ taskDetails[2].ChildCollection.Add((new Task() { ID = 14, Name = "Migrate critical issues", StartDate = new DateTime(2013, 3, 30), EndDate = new DateTime(2013, 7, 2), Progress = 20d, }));
+ taskDetails[2].ChildCollection.Add((new Task() { ID = 15, Name = "Estabilish change mgmt Control", StartDate = new DateTime(2013, 5, 3), EndDate = new DateTime(2013, 9, 6), Progress = 30d, }));
+ taskDetails[2].ChildCollection.Add((new Task() { ID = 16, Name = "Monitoring Progress", StartDate = new DateTime(2013, 7, 6), EndDate = new DateTime(2013, 12, 6), Progress = 30d }));
+
+ taskDetails.Add(new Task() { ID = 17, Name = "Post Implementation", StartDate = new DateTime(2013, 7, 25), EndDate = new DateTime(2012, 3, 12) });
+ taskDetails[3].ChildCollection.Add((new Task() { ID = 18, Name = "Obtain User feedback", StartDate = new DateTime(2013, 7, 25), EndDate = new DateTime(2014, 4, 29), Progress = 20d, }));
+ taskDetails[3].ChildCollection.Add((new Task() { ID = 19, Name = "Evaluate lessons learned", StartDate = new DateTime(2013, 10, 29), EndDate = new DateTime(2014, 7, 5), Progress = 20d, }));
+ taskDetails[3].ChildCollection.Add((new Task() { ID = 20, Name = "Modify items as necessary", StartDate = new DateTime(2014, 1, 2), EndDate = new DateTime(2014, 9, 8), Progress = 20d, }));
+ taskDetails[3].ChildCollection.Add((new Task() { ID = 21, Name = "Post Implementation Progress", StartDate = new DateTime(2014, 4, 8), EndDate = new DateTime(2014, 9, 12), Progress = 30d }));
+
+ taskDetails[0].ChildCollection[0].Resource.Add(new Resource() { ID = 1, Name = "Leslie" });
+ taskDetails[0].ChildCollection[1].Resource.Add(new Resource() { ID = 2, Name = "John" });
+ taskDetails[0].ChildCollection[2].Resource.Add(new Resource() { ID = 3, Name = "DavID" });
+ taskDetails[0].ChildCollection[3].Resource.Add(new Resource() { ID = 4, Name = "Peter" });
+
+ taskDetails[1].ChildCollection[0].Resource.Add(new Resource() { ID = 5, Name = "Neil" });
+ taskDetails[1].ChildCollection[1].Resource.Add(new Resource() { ID = 7, Name = "Johnson" });
+ taskDetails[1].ChildCollection[1].Resource.Add(new Resource() { ID = 8, Name = "Julie" });
+ taskDetails[1].ChildCollection[2].Resource.Add(new Resource() { ID = 9, Name = "Peterson" });
+ taskDetails[1].ChildCollection[3].Resource.Add(new Resource() { ID = 10, Name = "Thomas" });
+
+ taskDetails[3].ChildCollection[1].Resource.Add(new Resource() { ID = 5, Name = "DavID" });
+ taskDetails[3].ChildCollection[2].Resource.Add(new Resource() { ID = 7, Name = "Peter" });
+ taskDetails[3].ChildCollection[3].Resource.Add(new Resource() { ID = 8, Name = "Thomas" });
+
+ taskDetails[0].ChildCollection[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 2, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].ChildCollection[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].ChildCollection[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[1].ChildCollection[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 9, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].ChildCollection[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 10, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].ChildCollection[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 7, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[2].ChildCollection[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].ChildCollection[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].ChildCollection[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+
+ taskDetails[3].ChildCollection[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].ChildCollection[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].ChildCollection[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ return taskDetails;
+ }
+}
+{% endhighlight %}
+{% endtabs %}
-
+The following image shows custom DateTime schedule:
+
Custom DateTime Schedule
{:.caption}
diff --git a/wpf/Gantt/datetime-indicator-customization.md b/wpf/Gantt/datetime-indicator-customization.md
index 7a30e08240..a5f446f43b 100644
--- a/wpf/Gantt/datetime-indicator-customization.md
+++ b/wpf/Gantt/datetime-indicator-customization.md
@@ -65,29 +65,50 @@ The following code samples illustrate how to customize the DateTime indicator.
{% tabs %}
{% highlight xaml %}
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
{% endhighlight %}
{% highlight c# %}
+ this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
+ this.ganttControl.StickCurrentDateLineTo = CurentDateLinePositions.Today;
+
+// Task attribute mapping
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "TaskId";
+taskAttributeMapping.TaskNameMapping = "TaskName";
+taskAttributeMapping.StartDateMapping = "StartDate";
+taskAttributeMapping.ChildMapping = "Child";
+taskAttributeMapping.FinishDateMapping = "FinishDate";
+taskAttributeMapping.DurationMapping = "Duration";
+taskAttributeMapping.MileStoneMapping = "IsMileStone";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
//StrokeDashArray will change the style of Line
DoubleCollection strokeArray = new DoubleCollection();
@@ -100,13 +121,120 @@ this.Gantt.CurrentDateLine.StrokeDashArray = strokeArray;
this.Gantt.CurrentDateLine.StrokeThickness = 1;
{% endhighlight %}
+
+{% highlight c# tabtitle="ViewModel.cs" %}
+
+ public class ViewModel
+ {
+ ///
+ /// Holds the task collections.
+ ///
+ private ObservableCollection taskCollections;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ViewModel()
+ {
+ this.taskCollections = GetData();
+ }
+
+ ///
+ /// Gets or sets the appointment item source.
+ ///
+ /// The appointment item source.
+ public ObservableCollection TaskCollection
+ {
+ get
+ {
+ return this.taskCollections;
+ }
+ set
+ {
+ this.taskCollections = value;
+ }
+ }
+
+ ///
+ /// Gets the data.
+ ///
+ /// The task details
+ public ObservableCollection GetData()
+ {
+ var taskDetails = new ObservableCollection();
+
+ taskDetails.Add(new TaskDetails() { TaskId = 1, TaskName = "Analysis/Planning", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 2, TaskName = "Identify Components to be Localized", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 3, TaskName = "Ensure file localizability", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 4, TaskName = "Identify tools", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 5, TaskName = "Test tools", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 1), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 6, TaskName = "Develop delivery timeline", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 8, 1), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 7, TaskName = "Analysis Complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 10), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 8, TaskName = "Production", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 9, TaskName = "Software Components", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 10, TaskName = "Localization Component - User Interface", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 11, TaskName = "User Assistance Components", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 12, TaskName = "Software components complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 13, TaskName = "Quality Assurance", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 12), Progress = 40d, });
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 14, TaskName = "Review project information", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 15), Progress = 20d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 15, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 8), Progress = 20d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 16, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 17, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 18, TaskName = "Beta Testing", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 19, TaskName = "Disseminate completed product", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 20, TaskName = "Obtain feedback", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 21, TaskName = "Modify", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 22, TaskName = "Test", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 23, TaskName = "Complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 24, TaskName = "Post-Project Review", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 18), Progress = 40d, });
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 25, TaskName = "Finalize cost analysis", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 26, TaskName = "Analyze performance", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 27, TaskName = "Archive files", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 28, TaskName = "Document lessons learned", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 29, TaskName = "Distribute to team members", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 30, TaskName = "Post-project review complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+
+ taskDetails[0].Resources = new ObservableCollection() { new Resource { ID = 1, Name = "John" }, new Resource { ID = 2, Name = "Neil" } };
+ taskDetails[0].Child[3].Resources = new ObservableCollection() { new Resource() { ID = 3, Name = "Peter" } };
+ taskDetails[1].Resources = new ObservableCollection() { new Resource() { ID = 4, Name = "David" } };
+
+ taskDetails[0].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 2, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[1].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 9, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 10, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 7, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[2].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+
+ taskDetails[3].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[4].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 25, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 28, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 30, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[4].Predecessor.Add(new Predecessor() { GanttTaskIndex = 27, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ return taskDetails;
+ }
+}
+
+{% endhighlight %}
+
{% endtabs %}
#### Output
The following image shows the resultant output:
-
+
Customized DateTime Indicator
diff --git a/wpf/Gantt/flow-direction.md b/wpf/Gantt/flow-direction.md
index a1d830a732..21bc7fb745 100644
--- a/wpf/Gantt/flow-direction.md
+++ b/wpf/Gantt/flow-direction.md
@@ -15,16 +15,153 @@ Gantt provides support to display the contents from right-to-left or left-to-rig
{% highlight xaml %}
-
+
+
+
+
+
+
+
+
{% endhighlight %}
-
-{% highlight c# %}
-this.Gantt.FlowDirection = System.Windows.FlowDirection.RightToLeft;
+{% highlight c# %}
+
+ this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
+ this.ganttControl.FlowDirection = System.Windows.FlowDirection.RightToLeft;
+
+// Task attribute mapping
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "TaskId";
+taskAttributeMapping.TaskNameMapping = "TaskName";
+taskAttributeMapping.StartDateMapping = "StartDate";
+taskAttributeMapping.ChildMapping = "Child";
+taskAttributeMapping.FinishDateMapping = "FinishDate";
+taskAttributeMapping.DurationMapping = "Duration";
+taskAttributeMapping.MileStoneMapping = "IsMileStone";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
+
+{% endhighlight %}
+
+ {% highlight c# tabtitle="ViewModel.cs" %}
+ public class ViewModel
+ {
+ ///
+ /// Holds the task collections.
+ ///
+ private ObservableCollection taskCollections;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ViewModel()
+ {
+ this.taskCollections = GetData();
+ }
+
+ ///
+ /// Gets or sets the appointment item source.
+ ///
+ /// The appointment item source.
+ public ObservableCollection TaskCollection
+ {
+ get
+ {
+ return this.taskCollections;
+ }
+ set
+ {
+ this.taskCollections = value;
+ }
+ }
+
+ ///
+ /// Method to get the data.
+ ///
+ /// The task details
+ public ObservableCollection GetData()
+ {
+ var taskDetails = new ObservableCollection();
+
+ taskDetails.Add(new TaskDetails() { TaskId = 1, TaskName = "Analysis/Planning", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 2, TaskName = "Identify Components to be Localized", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 3, TaskName = "Ensure file localizability", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 4, TaskName = "Identify tools", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 5, TaskName = "Test tools", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 1), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 6, TaskName = "Develop delivery timeline", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 8, 1), Progress = 10d }));
+ taskDetails[0].Child.Add((new TaskDetails() { TaskId = 7, TaskName = "Analysis Complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 8, 10), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 8, TaskName = "Production", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 9, TaskName = "Software Components", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 10, TaskName = "Localization Component - User Interface", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 11, TaskName = "User Assistance Components", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[1].Child.Add((new TaskDetails() { TaskId = 12, TaskName = "Software components complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 13, TaskName = "Quality Assurance", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 12), Progress = 40d, });
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 14, TaskName = "Review project information", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 15), Progress = 20d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 15, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 8), Progress = 20d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 16, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[2].Child.Add((new TaskDetails() { TaskId = 17, TaskName = "Localization Component", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 18, TaskName = "Beta Testing", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 19, TaskName = "Disseminate completed product", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 20, TaskName = "Obtain feedback", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 21, TaskName = "Modify", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 22, TaskName = "Test", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+ taskDetails[3].Child.Add((new TaskDetails() { TaskId = 23, TaskName = "Complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 19), Progress = 10d }));
+
+ taskDetails.Add(new TaskDetails() { TaskId = 24, TaskName = "Post-Project Review", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 18), Progress = 40d, });
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 25, TaskName = "Finalize cost analysis", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 26, TaskName = "Analyze performance", StartDate = new DateTime(2011, 7, 6), FinishDate = new DateTime(2011, 7, 7), Progress = 20d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 27, TaskName = "Archive files", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 28, TaskName = "Document lessons learned", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 18), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 29, TaskName = "Distribute to team members", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+ taskDetails[4].Child.Add((new TaskDetails() { TaskId = 30, TaskName = "Post-project review complete", StartDate = new DateTime(2011, 7, 10), FinishDate = new DateTime(2011, 7, 14), Progress = 10d }));
+
+ taskDetails[0].Resources = new ObservableCollection() { new Resource { ID = 1, Name = "John" }, new Resource { ID = 2, Name = "Neil" } };
+ taskDetails[0].Child[3].Resources = new ObservableCollection() { new Resource() { ID = 3, Name = "Peter" } };
+ taskDetails[1].Resources = new ObservableCollection() { new Resource() { ID = 4, Name = "David" } };
+
+ taskDetails[0].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 2, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[0].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 3, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[1].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 9, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 10, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[1].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 7, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[2].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[2].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 12, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+
+ taskDetails[3].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[3].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+
+ taskDetails[4].Child[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 25, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 28, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 30, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ taskDetails[4].Child[4].Predecessor.Add(new Predecessor() { GanttTaskIndex = 27, GanttTaskRelationship = GanttTaskRelationship.StartToStart });
+ return taskDetails;
+ }
+}
{% endhighlight %}
{% endtabs %}
-
+
diff --git a/wpf/Gantt/highlighting-tasks.md b/wpf/Gantt/highlighting-tasks.md
index 2367f87103..6f702febf1 100644
--- a/wpf/Gantt/highlighting-tasks.md
+++ b/wpf/Gantt/highlighting-tasks.md
@@ -52,58 +52,951 @@ To highlight a set of tasks in Gantt chart region:
{% tabs %}
{% highlight xaml %}
-
-
+
+
+
+
+
+
+
+
{% endhighlight %}
{% highlight c# %}
-/// Codes in View Model
-///
-/// Initializes a new instance of the class.
-///
-public ViewModel()
-{
- this.AddHighlightedTasks();
-}
+this.ganttControl.ItemsSource = new ViewModel().TaskCollections;
+this.ganttControl.HighlightItemBrush = new SolidColorBrush(Colors.Red);
-IList _highlightedTasks = new List();
+/// Task attribute mapping
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "ID";
+taskAttributeMapping.TaskNameMapping = "Name";
+taskAttributeMapping.StartDateMapping = "StartDate";
+taskAttributeMapping.ChildMapping = "ChildCollection";
+taskAttributeMapping.FinishDateMapping = "EndDate";
+taskAttributeMapping.DurationMapping = "Duration";
+taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
-///
-/// Gets or sets the highlighted tasks.
-///
-/// The highlighted tasks.
-public IList HighlightedTasks
-{
- get
- {
- return _highlightedTasks;
- }
- set
- {
- _highlightedTasks = value;
- this.OnPropertyChanged("HighlightedTasks");
- }
-}
+{% endhighlight %}
+
+{% highlight c# tabtitle="Task.cs" %}
+
+ public class HighlightingTasksModel : NotificationObject
+ {
+ ///
+ /// Holds the id value.
+ ///
+ private int id;
+
+ ///
+ /// Holds the name value.
+ ///
+ private string name;
+
+ ///
+ /// Holds the start date value.
+ ///
+ private DateTime stDate;
+
+ ///
+ /// Holds the end date value.
+ ///
+ private DateTime endDate;
+
+ ///
+ /// Holds the duration value.
+ ///
+ private TimeSpan duration;
+
+ ///
+ /// Holds the resource value.
+ ///
+ private ObservableCollection resource;
+
+ ///
+ /// Holds the complete value.
+ ///
+ private double complete;
+
+ ///
+ /// Holds the child task value.
+ ///
+ private ObservableCollection childTask;
+
+ ///
+ /// Holds the predecessor value.
+ ///
+ private ObservableCollection predecessor;
+
+ ///
+ /// Holds the cost value.
+ ///
+ private Double cost;
+
+ ///
+ /// Holds the baseline start value.
+ ///
+ private DateTime baselineStart;
+
+ ///
+ /// Holds the baseline end value.
+ ///
+ private DateTime baselineEnd;
+
+ ///
+ /// Holds the baseline cost value.
+ ///
+ private Double baselineCost;
+
+ public HighlightingTasksModel()
+ {
+ this.ChildTask = new ObservableCollection();
+ this.Predecessor = new ObservableCollection();
+ this.Resource = new ObservableCollection();
+ }
+
+ ///
+ /// Gets or sets the complete.
+ ///
+ ///
+ /// The complete.
+ ///
+ public double Complete
+ {
+ get
+ {
+ return Math.Round(complete, 2);
+ }
+ set
+ {
+ if (value <= 100)
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ var sum = 0d;
+ this.complete = ((this.childTask.Aggregate(sum, (cur, task) => cur + task.Complete)) / this.childTask.Count);
+ }
+ else
+ this.complete = value;
+ this.RaisePropertyChanged("Complete");
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the resource.
+ ///
+ ///
+ /// The resource.
+ ///
+ public ObservableCollection Resource
+ {
+ get
+ {
+ return this.resource;
+ }
+ set
+ {
+ this.resource = value;
+ this.RaisePropertyChanged("Resource");
+ }
+ }
+
+
+ ///
+ /// Gets or sets the duration.
+ ///
+ ///
+ /// The duration.
+ ///
+ public TimeSpan Duration
+ {
+ get
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ var sum = new TimeSpan(0, 0, 0, 0);
+ sum = this.childTask.Aggregate(sum, (current, task) => current + task.Duration);
+ return sum;
+ }
+
+ /// Finish date is having 8 working hours, the dead line will include that too. Hence one day is added in calcuation to get the exact duration.
+
+ this.duration = endDate.Subtract(stDate);
+ return this.duration;
+ }
+
+ set
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ var sum = new TimeSpan(0, 0, 0, 0);
+ sum = this.childTask.Aggregate(sum, (current, task) => current + task.Duration);
+ this.duration = sum;
+ return;
+ }
+
+ this.duration = value;
+
+ /// When calculating finish date from duration we need to remove the extra date that we have added in duration to make the it fill the finish date too.
+ /// End date is beeing calcuated here to make the change in endate based on duration. Duration is interlinked with start and end date, so will affect both based on the change.
+ EndDate = stDate.AddDays(Double.Parse((duration.TotalDays).ToString()));
+
+ }
+ }
+
+ ///
+ /// Gets or sets the end date.
+ ///
+ ///
+ /// The end date.
+ ///
+ public DateTime EndDate
+ {
+ get
+ {
+ return endDate;
+ }
+ set
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ /// If this task is a parent task, then it should have the maximum end time. Hence comparing the date with maximum date of its children.
+
+ if (value >= this.childTask.Max(s => s.EndDate) && this.endDate != value)
+ this.endDate = value;
+ }
+ else
+ endDate = value;
+ this.RaisePropertyChanged("EndDate");
+ /// Duration changed is invoked to notify the chagne in duration based on the new end date.
+ this.RaisePropertyChanged("Duration");
+ }
+ }
+
+ ///
+ /// Gets or sets the start date.
+ ///
+ ///
+ /// The start date.
+ ///
+ public DateTime StDate
+ {
+ get
+ {
+ return this.stDate;
+ }
+ set
+ {
+ /// If this task is a parent task, then it should have the minimum start time. Hence comparing the date with minimum date of its children.
+
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ if (value <= this.childTask.Min(s => s.stDate) && this.stDate != value)
+ this.stDate = value;
+ }
+ else
+ this.stDate = value;
+ this.RaisePropertyChanged("StDate");
+
+ /// Duration chagned is invoked to notify the chagne in duration based on the new start date.
+ this.RaisePropertyChanged("Duration");
+ }
+ }
+
+ ///
+ /// Gets or sets the name.
+ ///
+ ///
+ /// The name.
+ ///
+ public string Name
+ {
+ get
+ {
+ return this.name;
+ }
+ set
+ {
+ this.name = value;
+ this.RaisePropertyChanged("Name");
+ }
+ }
+
+ ///
+ /// Gets or sets the id.
+ ///
+ ///
+ /// The id.
+ ///
+ public int Id
+ {
+ get
+ {
+ return this.id;
+ }
+ set
+ {
+ this.id = value;
+ this.RaisePropertyChanged("Id");
+ }
+ }
+
+ ///
+ /// Gets or sets the predecessor.
+ ///
+ ///
+ /// The predecessor.
+ ///
+ public ObservableCollection Predecessor
+ {
+ get
+ {
+ return this.predecessor;
+ }
+ set
+ {
+ this.predecessor = value;
+ this.RaisePropertyChanged("Predecessor");
+ }
+ }
+ ///
+ /// Gets or sets the cost.
+ ///
+ ///
+ /// The cost.
+ ///
+ public Double Cost
+ {
+ get
+ {
+ return this.cost;
+ }
+ set
+ {
+ if (this.cost != value)
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ var sum = 0d;
+ this.cost = this.childTask.Aggregate(sum, (cur, task) => cur + task.Cost);
+ }
+ else
+ this.cost = value;
+ this.RaisePropertyChanged("Cost");
+ }
+
+ }
+ }
+
+ ///
+ /// Gets or sets the Baseline start.
+ ///
+ ///
+ /// The Baseline start.
+ ///
+ public DateTime BaselineStart
+ {
+ get
+ {
+ return this.baselineStart;
+ }
+ set
+ {
+ if (this.baselineStart != value)
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ this.baselineStart = this.childTask.Min(s => s.baselineStart);
+ }
+ else
+ this.baselineStart = value;
+ this.RaisePropertyChanged("BaselineStart");
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the Baseline end.
+ ///
+ ///
+ /// The Baseline end.
+ ///
+ public DateTime BaselineEnd
+ {
+ get
+ {
+ return this.baselineEnd;
+ }
+ set
+ {
+ if (this.baselineEnd != value)
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ this.baselineEnd = childTask.Max(s => s.baselineEnd);
+ }
+ else
+ this.baselineEnd = value;
+ RaisePropertyChanged("BaselineEnd");
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the baseline cost.
+ ///
+ ///
+ /// The baseline cost.
+ ///
+ public Double BaselineCost
+ {
+ get
+ {
+ return this.baselineCost;
+ }
+ set
+ {
+ if (BaselineCost != value)
+ {
+ if (this.childTask != null && this.childTask.Count >= 1)
+ {
+ var sum = 0d;
+ this.baselineCost = this.childTask.Aggregate(sum, (current, task) => current + task.baselineCost);
+ }
+ else
+ this.baselineCost = value;
+ this.RaisePropertyChanged("BaselineCost");
+ }
+
+ }
+ }
+
+ #region ChildTask Collection
+
+ public ObservableCollection ChildTask
+ {
+ get
+ {
+ if (childTask == null)
+ {
+ childTask = new ObservableCollection();
+ /// Collection changed of child tasks are hooked to listen and refresh the parent node based on the changes made in Child.
+ childTask.CollectionChanged += ChildNodesCollectionChanged;
+ }
+ return childTask;
+ }
+ set
+ {
+ childTask = value;
+ ///Collection changed of child tasks are hooked to listen and refresh the parent node based on the changes made in Child.
+
+ childTask.CollectionChanged += ChildNodesCollectionChanged;
+
+ if (value.Count > 0)
+ {
+ childTask.ToList().ForEach(n =>
+ {
+ /// To listen the changes occuring in child task.
+ n.PropertyChanged += ChildNodePropertyChanged;
+
+ });
+ UpdateData();
+ }
+ RaisePropertyChanged("ChildTask");
+ }
+ }
+ ///
+ /// The following does the calculations to update the Parent Task, when child collection property changes.
+ ///
+ /// The source
+ /// Property changed event args
+ void ChildNodePropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName != null)
+ if (e.PropertyName != null)
+ if (e.PropertyName == "StDate" || e.PropertyName == "EndDate" || e.PropertyName == "Cost" || e.PropertyName == "BaselineStart" ||
+ e.PropertyName == "BaselineEnd" || e.PropertyName == "BaselineCost" || e.PropertyName == "Complete")
+ {
+ UpdateData();
+ }
+ }
+ ///
+ /// Updates the data.
+ ///
+ private void UpdateData()
+ {
+ /// Updating the Required Data based on the chagne occur in the date of child task
+ if (childTask == null || childTask.Count == 0)
+ {
+ return;
+ }
+
+ StDate = childTask.Select(c => c.StDate).Min();
+ EndDate = childTask.Select(c => c.EndDate).Max();
+ BaselineStart = childTask.Select(c => c.BaselineStart).Min();
+ BaselineEnd = childTask.Select(c => c.BaselineEnd).Max();
+ Cost = childTask.Aggregate(0d, (cur, task) => cur + task.Cost);
+ BaselineCost = childTask.Aggregate(0d, (cur, task) => cur + task.BaselineCost);
+ Complete = ((childTask.Aggregate(0d, (cur, task) => cur + task.Complete)) / childTask.Count);
+ }
+
+ ///
+ /// handles the child nodes collection changed.
+ ///
+ /// The sender.
+ /// The instance containing the event data.
+ public void ChildNodesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+ {
+ if (e.Action == NotifyCollectionChangedAction.Add)
+ {
+ foreach (HighlightingTasksModel node in e.NewItems)
+ {
+ node.PropertyChanged += ChildNodePropertyChanged;
+ }
+ }
+ else
+ {
+ foreach (HighlightingTasksModel node in e.OldItems)
+ node.PropertyChanged -= ChildNodePropertyChanged;
+ }
+ UpdateData();
+ }
+
+ #endregion
+ }
+
+ public class TaskRepository : NotificationObject
+ {
+ ///
+ /// Holds the task collections.
+ ///
+ private ObservableCollection _taskCollections;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public TaskRepository()
+ {
+ this._taskCollections = GetData();
+ }
+
+ ///
+ /// Gets or sets the appointment item source.
+ ///
+ /// The appointment item source.
+ public ObservableCollection TaskCollections
+ {
+ get
+ {
+ return this._taskCollections;
+ }
+ set
+ {
+ this._taskCollections = value;
+ }
+ }
+
+ ///
+ /// Gets the data.
+ ///
+ /// The task details
+ public ObservableCollection GetData()
+ {
+ var taskDetails = new ObservableCollection();
+
+ // Collection to Strore the Required Resources.
+ ObservableCollection ResidentialConstructionResources = new ObservableCollection();
+ ResidentialConstructionResources = GetResources();
+
+ // Adding Tasks
+
+ taskDetails.Add(new HighlightingTasksModel() { Id = 1, Name = "Residential Construction (2500 sq.ft)", StDate = new DateTime(2012, 3, 1), EndDate = new DateTime(2012, 3, 15), Complete = 0d, Cost = 500, BaselineCost = 833d, BaselineStart = new DateTime(2012, 2, 1), BaselineEnd = new DateTime(2012, 2, 17) });
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 2, Name = "General Considerations", StDate = new DateTime(2012, 7, 3), EndDate = new DateTime(2012, 7, 14), Complete = 0d, Cost = 89, BaselineCost = 833d, BaselineStart = DateTime.Today, BaselineEnd = DateTime.Today });
+
+ taskDetails[0].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 3, Name = "Finalize and Approve Plans", StDate = new DateTime(2012, 3, 1), EndDate = new DateTime(2012, 3, 15), Complete = 0d, Cost = 500, BaselineCost = 833d, BaselineStart = new DateTime(2012, 2, 1), BaselineEnd = new DateTime(2012, 2, 17) });
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 4, Name = "Review and Finalize Site Plans", StDate = new DateTime(2012, 3, 1), EndDate = new DateTime(2012, 3, 20), Complete = 0d, Cost = 500, BaselineCost = 833d, BaselineStart = new DateTime(2012, 2, 1), BaselineEnd = new DateTime(2012, 2, 17) });
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 5, Name = "Sign contract and Proceed", StDate = new DateTime(2012, 3, 20), EndDate = new DateTime(2012, 3, 22), Complete = 0d, Cost = 500, BaselineCost = 833d, BaselineStart = new DateTime(2012, 2, 1), BaselineEnd = new DateTime(2012, 2, 17) });
+
+ taskDetails[0].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 6, Name = "Contracts and Agreements", StDate = new DateTime(2012, 3, 22), EndDate = new DateTime(2012, 3, 22), Complete = 0d, BaselineStart = new DateTime(2012, 3, 12), BaselineEnd = new DateTime(2012, 3, 12), Cost = 20d, BaselineCost = 14 });
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask.Add((new HighlightingTasksModel() { Id = 7, Name = "Lot Sale Agreement", StDate = new DateTime(2012, 3, 22), EndDate = new DateTime(2012, 3, 22), Complete = 0d, BaselineStart = new DateTime(2012, 3, 12), BaselineEnd = new DateTime(2012, 3, 12), Cost = 20d, BaselineCost = 14 }));
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask.Add((new HighlightingTasksModel() { Id = 8, Name = "Construction Agreement", StDate = new DateTime(2012, 3, 22), EndDate = new DateTime(2012, 3, 22), Complete = 0d, BaselineStart = new DateTime(2012, 3, 12), BaselineEnd = new DateTime(2012, 3, 12), Cost = 33d, BaselineCost = 12 }));
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask.Add((new HighlightingTasksModel() { Id = 9, Name = "Contract Specifications", StDate = new DateTime(2012, 3, 22), EndDate = new DateTime(2012, 3, 22), Complete = 0d, BaselineStart = new DateTime(2012, 3, 12), BaselineEnd = new DateTime(2012, 3, 12), Cost = 30d, BaselineCost = 50 }));
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask.Add((new HighlightingTasksModel() { Id = 10, Name = "Contract Site Plan", StDate = new DateTime(2012, 3, 22), EndDate = new DateTime(2012, 3, 22), Complete = 0d, BaselineStart = new DateTime(2012, 3, 12), BaselineEnd = new DateTime(2012, 3, 12), Cost = 360d, BaselineCost = 100 }));
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask.Add((new HighlightingTasksModel() { Id = 11, Name = "Financing", StDate = new DateTime(2012, 3, 22), EndDate = new DateTime(2012, 3, 22), Complete = 0d, BaselineStart = new DateTime(2012, 3, 12), BaselineEnd = new DateTime(2012, 3, 12), Cost = 39d, BaselineCost = 16 }));
+
+ taskDetails[0].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 12, Name = "Apply Permits", StDate = new DateTime(2012, 3, 23), EndDate = new DateTime(2012, 3, 24), Complete = 0d, BaselineStart = new DateTime(2012, 3, 2), BaselineEnd = new DateTime(2012, 3, 5), Cost = 53d, BaselineCost = 65 });
+ taskDetails[0].ChildTask[0].ChildTask[2].ChildTask.Add((new HighlightingTasksModel() { Id = 13, Name = "Foundation Permit", StDate = new DateTime(2012, 3, 23), EndDate = new DateTime(2012, 3, 24), Complete = 0d, BaselineStart = new DateTime(2012, 3, 2), BaselineEnd = new DateTime(2012, 3, 5), Cost = 53d, BaselineCost = 65 }));
+ taskDetails[0].ChildTask[0].ChildTask[2].ChildTask.Add((new HighlightingTasksModel() { Id = 14, Name = "Electrical Permit", StDate = new DateTime(2012, 3, 24), EndDate = new DateTime(2012, 3, 25), Complete = 0d, BaselineStart = new DateTime(2012, 3, 4), BaselineEnd = new DateTime(2012, 3, 6), Cost = 23d, BaselineCost = 34 }));
+ taskDetails[0].ChildTask[0].ChildTask[2].ChildTask.Add((new HighlightingTasksModel() { Id = 15, Name = "Plumbing Permit", StDate = new DateTime(2012, 3, 25), EndDate = new DateTime(2012, 3, 26), Complete = 0d, BaselineStart = new DateTime(2012, 3, 5), BaselineEnd = new DateTime(2012, 3, 7), Cost = 63d, BaselineCost = 53 }));
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 16, Name = "Site Work", StDate = new DateTime(2012, 3, 26), EndDate = new DateTime(2012, 3, 27), Complete = 0d, BaselineStart = new DateTime(2012, 3, 26), BaselineEnd = new DateTime(2012, 3, 26), Cost = 2000d, BaselineCost = 1000 });
+ taskDetails[0].ChildTask[1].ChildTask.Add(new HighlightingTasksModel() { Id = 17, Name = "Clear Lot", StDate = new DateTime(2012, 3, 26), EndDate = new DateTime(2012, 3, 27), Complete = 0d, BaselineStart = new DateTime(2012, 3, 26), BaselineEnd = new DateTime(2012, 3, 26), Cost = 2000d, BaselineCost = 1000 });
+ taskDetails[0].ChildTask[1].ChildTask.Add(new HighlightingTasksModel() { Id = 18, Name = "Strip Topsoil", StDate = new DateTime(2012, 3, 27), EndDate = new DateTime(2012, 3, 28), Complete = 0d, BaselineStart = new DateTime(2012, 3, 26), BaselineEnd = new DateTime(2012, 3, 27), Cost = 1200d, BaselineCost = 800 });
+ taskDetails[0].ChildTask[1].ChildTask.Add(new HighlightingTasksModel() { Id = 19, Name = "Installing Temporary requirements", StDate = new DateTime(2012, 3, 28), EndDate = new DateTime(2012, 3, 29), Complete = 0d, BaselineStart = new DateTime(2012, 3, 25), BaselineEnd = new DateTime(2012, 3, 28), Cost = 354d, BaselineCost = 230 });
-///
-/// Adds the highlighted tasks.
-///
-internal void AddHighlightedTasks()
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 20, Name = "Foundation", StDate = new DateTime(2012, 3, 29), EndDate = new DateTime(2012, 4, 2), Complete = 0d, Cost = 899, BaselineCost = 833d, BaselineStart = new DateTime(2012, 4, 29), BaselineEnd = new DateTime(2012, 4, 2) });
+ taskDetails[0].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 21, Name = "Excavate for foundation", StDate = new DateTime(2012, 3, 29), EndDate = new DateTime(2012, 4, 2), Complete = 0d, Cost = 899, BaselineCost = 833d, BaselineStart = new DateTime(2012, 4, 29), BaselineEnd = new DateTime(2012, 4, 2) });
+ taskDetails[0].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 22, Name = "Building Basement Walls", StDate = new DateTime(2012, 4, 3), EndDate = new DateTime(2012, 4, 8), Complete = 0d, Cost = 889, BaselineCost = 803d, BaselineStart = new DateTime(2012, 4, 5), BaselineEnd = new DateTime(2012, 4, 15) });
+ taskDetails[0].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 23, Name = "Foundation inspection", StDate = new DateTime(2012, 4, 8), EndDate = new DateTime(2012, 4, 10), Complete = 0d, Cost = 8, BaselineCost = 8d, BaselineStart = new DateTime(2012, 4, 14), BaselineEnd = new DateTime(2012, 4, 16) });
+ taskDetails[0].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 24, Name = "Finishing Foundation", StDate = new DateTime(2012, 4, 10), EndDate = new DateTime(2012, 4, 17), Complete = 0d, Cost = 0, BaselineCost = 8d, BaselineStart = new DateTime(2012, 4, 17), BaselineEnd = new DateTime(2012, 4, 17) });
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 25, Name = "Framing", StDate = new DateTime(2012, 4, 18), EndDate = new DateTime(2012, 4, 24), Complete = 0d, Cost = 890, BaselineCost = 803d, BaselineStart = new DateTime(2012, 4, 18), BaselineEnd = new DateTime(2012, 5, 7) });
+ taskDetails[0].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 26, Name = "First Floor Framing", StDate = new DateTime(2012, 4, 18), EndDate = new DateTime(2012, 4, 24), Complete = 0d, Cost = 890, BaselineCost = 803d, BaselineStart = new DateTime(2012, 4, 18), BaselineEnd = new DateTime(2012, 5, 7) });
+ taskDetails[0].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 27, Name = "Second Floor Framing", StDate = new DateTime(2012, 4, 24), EndDate = new DateTime(2012, 5, 3), Complete = 0d, Cost = 789, BaselineCost = 898d, BaselineStart = new DateTime(2012, 5, 8), BaselineEnd = new DateTime(2012, 5, 18) });
+ taskDetails[0].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 28, Name = "Framing Roof", StDate = new DateTime(2012, 5, 3), EndDate = new DateTime(2012, 5, 7), Complete = 0d, Cost = 780, BaselineCost = 833d, BaselineStart = new DateTime(2012, 5, 18), BaselineEnd = new DateTime(2012, 5, 23) });
+ taskDetails[0].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 29, Name = "Framing Inspection", StDate = new DateTime(2012, 5, 7), EndDate = new DateTime(2012, 5, 8), Complete = 0d, Cost = 5, BaselineCost = 8d, BaselineStart = new DateTime(2012, 5, 18), BaselineEnd = new DateTime(2012, 5, 30) });
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 30, Name = "Dry In", StDate = new DateTime(2012, 5, 8), EndDate = new DateTime(2012, 5, 14), Complete = 0d, Cost = 232, BaselineCost = 323d, BaselineStart = new DateTime(2012, 5, 30), BaselineEnd = new DateTime(2012, 6, 2) });
+ taskDetails[0].ChildTask[4].ChildTask.Add(new HighlightingTasksModel() { Id = 31, Name = "Installing Sheathing for floors", StDate = new DateTime(2012, 5, 8), EndDate = new DateTime(2012, 5, 14), Complete = 0d, Cost = 232, BaselineCost = 323d, BaselineStart = new DateTime(2012, 5, 30), BaselineEnd = new DateTime(2012, 6, 2) });
+ taskDetails[0].ChildTask[4].ChildTask.Add(new HighlightingTasksModel() { Id = 32, Name = "Installing Windows", StDate = new DateTime(2012, 5, 14), EndDate = new DateTime(2012, 5, 25), Complete = 0d, Cost = 325, BaselineCost = 452d, BaselineStart = new DateTime(2012, 6, 4), BaselineEnd = new DateTime(2012, 6, 17) });
+ taskDetails[0].ChildTask[4].ChildTask.Add(new HighlightingTasksModel() { Id = 33, Name = "Installing Sheathing for Roof", StDate = new DateTime(2012, 5, 25), EndDate = new DateTime(2012, 5, 30), Complete = 0d, Cost = 82, BaselineCost = 83d, BaselineStart = new DateTime(2012, 6, 18), BaselineEnd = new DateTime(2012, 6, 20) });
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 34, Name = "Exterior Finishing", StDate = new DateTime(2012, 5, 31), EndDate = new DateTime(2012, 6, 12), Complete = 0d, Cost = 463, BaselineCost = 633d, BaselineStart = new DateTime(2012, 6, 20), BaselineEnd = new DateTime(2012, 6, 25) });
+ taskDetails[0].ChildTask[5].ChildTask.Add(new HighlightingTasksModel() { Id = 35, Name = "Exterior Trimming", StDate = new DateTime(2012, 5, 31), EndDate = new DateTime(2012, 6, 12), Complete = 0d, Cost = 463, BaselineCost = 633d, BaselineStart = new DateTime(2012, 6, 20), BaselineEnd = new DateTime(2012, 6, 25) });
+ taskDetails[0].ChildTask[5].ChildTask.Add(new HighlightingTasksModel() { Id = 36, Name = "Completing Exterior Bricks", StDate = new DateTime(2012, 6, 12), EndDate = new DateTime(2012, 6, 17), Complete = 0d, Cost = 234, BaselineCost = 333d, BaselineStart = new DateTime(2012, 6, 26), BaselineEnd = new DateTime(2012, 6, 28) });
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 37, Name = "Interior Finishing", StDate = new DateTime(2012, 6, 17), EndDate = new DateTime(2012, 6, 19), Complete = 0d, Cost = 43, BaselineCost = 33d, BaselineStart = new DateTime(2012, 6, 28), BaselineEnd = new DateTime(2012, 7, 9) });
+
+ taskDetails[0].ChildTask[6].ChildTask.Add(new HighlightingTasksModel() { Id = 38, Name = "Installing Insulation", StDate = new DateTime(2012, 6, 17), EndDate = new DateTime(2012, 6, 19), Complete = 0d, Cost = 43, BaselineCost = 33d, BaselineStart = new DateTime(2012, 6, 28), BaselineEnd = new DateTime(2012, 7, 9) });
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 39, Name = "Install Floor Insulation", StDate = new DateTime(2012, 6, 17), EndDate = new DateTime(2012, 6, 19), Complete = 0d, Cost = 43, BaselineCost = 33d, BaselineStart = new DateTime(2012, 6, 28), BaselineEnd = new DateTime(2012, 7, 9) });
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 40, Name = "Install Wall Insulation", StDate = new DateTime(2012, 6, 19), EndDate = new DateTime(2012, 6, 21), Complete = 0d, Cost = 53, BaselineCost = 83d, BaselineStart = new DateTime(2012, 7, 10), BaselineEnd = new DateTime(2012, 7, 20) });
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask.Add(new HighlightingTasksModel() { Id = 41, Name = "Install Ceiling Insulation", StDate = new DateTime(2012, 6, 21), EndDate = new DateTime(2012, 6, 22), Complete = 0d, Cost = 89, BaselineCost = 83d, BaselineStart = new DateTime(2012, 7, 20), BaselineEnd = new DateTime(2012, 7, 22) });
+
+ taskDetails[0].ChildTask[6].ChildTask.Add(new HighlightingTasksModel() { Id = 42, Name = "Painting and Wallpaper", StDate = new DateTime(2012, 6, 22), EndDate = new DateTime(2012, 6, 23), Complete = 0d, Cost = 453, BaselineCost = 563, BaselineStart = new DateTime(2012, 7, 21), BaselineEnd = new DateTime(2012, 7, 25) });
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask.Add(new HighlightingTasksModel() { Id = 43, Name = "Painting all Interior", StDate = new DateTime(2012, 6, 22), EndDate = new DateTime(2012, 6, 23), Complete = 0d, Cost = 453, BaselineCost = 563, BaselineStart = new DateTime(2012, 7, 21), BaselineEnd = new DateTime(2012, 7, 25) });
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask.Add(new HighlightingTasksModel() { Id = 44, Name = "Painting all Exterior", StDate = new DateTime(2012, 6, 23), EndDate = new DateTime(2012, 6, 25), Complete = 0d, Cost = 352, BaselineCost = 342, BaselineStart = new DateTime(2012, 7, 26), BaselineEnd = new DateTime(2012, 7, 27) });
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask.Add(new HighlightingTasksModel() { Id = 45, Name = "Additional Trimming Work", StDate = new DateTime(2012, 6, 25), EndDate = new DateTime(2012, 6, 27), Complete = 0d, Cost = 32, BaselineCost = 50, BaselineStart = new DateTime(2012, 7, 28), BaselineEnd = new DateTime(2012, 7, 29) });
+
+ taskDetails[0].ChildTask[6].ChildTask.Add(new HighlightingTasksModel() { Id = 46, Name = "Finishing Plumbing", StDate = new DateTime(2012, 6, 27), EndDate = new DateTime(2012, 6, 29), Complete = 0d, Cost = 424, BaselineCost = 423, BaselineStart = new DateTime(2012, 7, 29), BaselineEnd = new DateTime(2012, 8, 1) });
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 47, Name = "First floor Plumbing", StDate = new DateTime(2012, 6, 27), EndDate = new DateTime(2012, 6, 29), Complete = 0d, Cost = 424, BaselineCost = 423, BaselineStart = new DateTime(2012, 7, 29), BaselineEnd = new DateTime(2012, 8, 1) });
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 48, Name = "Second floor plumbing", StDate = new DateTime(2012, 6, 29), EndDate = new DateTime(2012, 7, 1), Complete = 0d, Cost = 234, BaselineCost = 324, BaselineStart = new DateTime(2012, 8, 1), BaselineEnd = new DateTime(2012, 8, 9) });
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask.Add(new HighlightingTasksModel() { Id = 49, Name = "Inspecting Plumbing", StDate = new DateTime(2012, 7, 1), EndDate = new DateTime(2012, 7, 3), Complete = 0d, Cost = 23, BaselineCost = 33d, BaselineStart = new DateTime(2012, 8, 10), BaselineEnd = new DateTime(2012, 8, 17) });
+
+ taskDetails[0].ChildTask[6].ChildTask.Add(new HighlightingTasksModel() { Id = 50, Name = "Finishing Electrical", StDate = new DateTime(2012, 7, 3), EndDate = new DateTime(2012, 7, 5), Complete = 0d, Cost = 432, BaselineCost = 536, BaselineStart = new DateTime(2012, 8, 17), BaselineEnd = new DateTime(2012, 8, 19) });
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 51, Name = "Complete first floor connections", StDate = new DateTime(2012, 7, 3), EndDate = new DateTime(2012, 7, 5), Complete = 0d, Cost = 432, BaselineCost = 536, BaselineStart = new DateTime(2012, 8, 17), BaselineEnd = new DateTime(2012, 8, 19) });
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 52, Name = "Complete second floor connections", StDate = new DateTime(2012, 7, 5), EndDate = new DateTime(2012, 7, 7), Complete = 0d, Cost = 563, BaselineCost = 463, BaselineStart = new DateTime(2012, 8, 18), BaselineEnd = new DateTime(2012, 8, 19) });
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask.Add(new HighlightingTasksModel() { Id = 53, Name = "Complete non-Electrical Wiring", StDate = new DateTime(2012, 7, 7), EndDate = new DateTime(2012, 7, 8), Complete = 0d, Cost = 234, BaselineCost = 563, BaselineStart = new DateTime(2012, 8, 19), BaselineEnd = new DateTime(2012, 8, 20) });
+
+ taskDetails[0].ChildTask[6].ChildTask.Add(new HighlightingTasksModel() { Id = 54, Name = "Carpet,Tiles and Furnishing", StDate = new DateTime(2012, 7, 8), EndDate = new DateTime(2012, 7, 10), Complete = 0d, Cost = 253, BaselineCost = 210, BaselineStart = new DateTime(2012, 8, 20), BaselineEnd = new DateTime(2012, 8, 21) });
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask.Add(new HighlightingTasksModel() { Id = 55, Name = "Complete first floor carpet", StDate = new DateTime(2012, 7, 8), EndDate = new DateTime(2012, 7, 10), Complete = 0d, Cost = 253, BaselineCost = 210, BaselineStart = new DateTime(2012, 8, 20), BaselineEnd = new DateTime(2012, 8, 21) });
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask.Add(new HighlightingTasksModel() { Id = 56, Name = "Complete second floor carpet", StDate = new DateTime(2012, 7, 10), EndDate = new DateTime(2012, 7, 13), Complete = 0d, Cost = 341, BaselineCost = 300, BaselineStart = new DateTime(2012, 8, 21), BaselineEnd = new DateTime(2012, 8, 22) });
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask.Add(new HighlightingTasksModel() { Id = 57, Name = "Complete Furnishing Kitchen, bath, hall", StDate = new DateTime(2012, 7, 13), EndDate = new DateTime(2012, 7, 14), Complete = 0, Cost = 4252, BaselineCost = 6033d, BaselineStart = new DateTime(2012, 8, 22), BaselineEnd = new DateTime(2012, 8, 25) });
+
+ taskDetails[0].ChildTask.Add(new HighlightingTasksModel() { Id = 58, Name = "Final Acceptance", StDate = new DateTime(2012, 7, 14), EndDate = new DateTime(2012, 7, 16), Complete = 0d, Cost = 430, BaselineCost = 433d, BaselineStart = new DateTime(2012, 8, 25), BaselineEnd = new DateTime(2012, 8, 26) });
+ taskDetails[0].ChildTask[7].ChildTask.Add(new HighlightingTasksModel() { Id = 59, Name = "Cleaning", StDate = new DateTime(2012, 7, 14), EndDate = new DateTime(2012, 7, 16), Complete = 0d, Cost = 430, BaselineCost = 433d, BaselineStart = new DateTime(2012, 8, 25), BaselineEnd = new DateTime(2012, 8, 26) });
+ taskDetails[0].ChildTask[7].ChildTask.Add(new HighlightingTasksModel() { Id = 60, Name = "Final Inspection", StDate = new DateTime(2012, 7, 16), EndDate = new DateTime(2012, 7, 17), Complete = 0d, Cost = 0, BaselineCost = 5, BaselineStart = new DateTime(2012, 8, 26), BaselineEnd = new DateTime(2012, 8, 27) });
+ taskDetails[0].ChildTask[7].ChildTask.Add(new HighlightingTasksModel() { Id = 61, Name = "Move In", StDate = new DateTime(2012, 7, 17), EndDate = new DateTime(2012, 7, 17), Complete = 0d, Cost = 0, BaselineCost = 0, BaselineStart = new DateTime(2012, 8, 28), BaselineEnd = new DateTime(2012, 8, 28) });
+
+ //Adding Resources
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[0].Resource.Add(ResidentialConstructionResources[1]);
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[0].Resource.Add(ResidentialConstructionResources[0]);
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[0].Resource.Add(ResidentialConstructionResources[2]);
+
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[1].Resource.Add(ResidentialConstructionResources[0]);
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[1].Resource.Add(ResidentialConstructionResources[1]);
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[1].Resource.Add(ResidentialConstructionResources[2]);
+
+ taskDetails[0].ChildTask[1].ChildTask[0].Resource.Add(ResidentialConstructionResources[3]);
+ taskDetails[0].ChildTask[1].ChildTask[1].Resource.Add(ResidentialConstructionResources[3]);
+ taskDetails[0].ChildTask[1].ChildTask[2].Resource.Add(ResidentialConstructionResources[5]);
+ taskDetails[0].ChildTask[1].ChildTask[2].Resource.Add(ResidentialConstructionResources[6]);
+ taskDetails[0].ChildTask[1].ChildTask[2].Resource.Add(ResidentialConstructionResources[4]);
+
+ taskDetails[0].ChildTask[2].ChildTask[0].Resource.Add(ResidentialConstructionResources[3]);
+ taskDetails[0].ChildTask[2].ChildTask[1].Resource.Add(ResidentialConstructionResources[6]);
+ taskDetails[0].ChildTask[2].ChildTask[2].Resource.Add(ResidentialConstructionResources[7]);
+ taskDetails[0].ChildTask[2].ChildTask[3].Resource.Add(ResidentialConstructionResources[3]);
+
+ taskDetails[0].ChildTask[3].ChildTask[0].Resource.Add(ResidentialConstructionResources[8]);
+ taskDetails[0].ChildTask[3].ChildTask[1].Resource.Add(ResidentialConstructionResources[8]);
+ taskDetails[0].ChildTask[3].ChildTask[2].Resource.Add(ResidentialConstructionResources[9]);
+ taskDetails[0].ChildTask[3].ChildTask[3].Resource.Add(ResidentialConstructionResources[7]);
+
+ taskDetails[0].ChildTask[4].ChildTask[0].Resource.Add(ResidentialConstructionResources[8]);
+ taskDetails[0].ChildTask[4].ChildTask[1].Resource.Add(ResidentialConstructionResources[9]);
+ taskDetails[0].ChildTask[4].ChildTask[2].Resource.Add(ResidentialConstructionResources[8]);
+
+ taskDetails[0].ChildTask[5].ChildTask[0].Resource.Add(ResidentialConstructionResources[14]);
+ taskDetails[0].ChildTask[5].ChildTask[1].Resource.Add(ResidentialConstructionResources[8]);
+
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask[0].Resource.Add(ResidentialConstructionResources[10]);
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask[1].Resource.Add(ResidentialConstructionResources[10]);
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask[2].Resource.Add(ResidentialConstructionResources[10]);
+
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[0].Resource.Add(ResidentialConstructionResources[12]);
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[1].Resource.Add(ResidentialConstructionResources[12]);
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[2].Resource.Add(ResidentialConstructionResources[12]);
+
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask[0].Resource.Add(ResidentialConstructionResources[5]);
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask[1].Resource.Add(ResidentialConstructionResources[5]);
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask[2].Resource.Add(ResidentialConstructionResources[7]);
+
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[0].Resource.Add(ResidentialConstructionResources[4]);
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[1].Resource.Add(ResidentialConstructionResources[4]);
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[2].Resource.Add(ResidentialConstructionResources[4]);
+
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask[0].Resource.Add(ResidentialConstructionResources[13]);
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask[1].Resource.Add(ResidentialConstructionResources[13]);
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask[2].Resource.Add(ResidentialConstructionResources[14]);
+
+ taskDetails[0].ChildTask[7].ChildTask[0].Resource.Add(ResidentialConstructionResources[16]);
+ taskDetails[0].ChildTask[7].ChildTask[1].Resource.Add(ResidentialConstructionResources[7]);
+ taskDetails[0].ChildTask[7].ChildTask[2].Resource.Add(ResidentialConstructionResources[1]);
+
+ //Adding Predecessors
+ taskDetails[0].ChildTask[0].ChildTask[0].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 4, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[0].ChildTask[0].ChildTask[1].ChildTask[4].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+
+ taskDetails[0].ChildTask[0].ChildTask[2].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[0].ChildTask[0].ChildTask[2].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+ taskDetails[0].ChildTask[0].ChildTask[2].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 5, GanttTaskRelationship = GanttTaskRelationship.FinishToFinish });
+
+ taskDetails[0].ChildTask[1].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 13, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[1].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 14, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[1].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 15, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[1].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 17, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[1].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 18, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[2].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[2].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 21, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[2].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 19, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[2].ChildTask[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 23, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[3].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 24, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[3].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 26, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[3].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 27, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[3].ChildTask[3].Predecessor.Add(new Predecessor() { GanttTaskIndex = 28, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[4].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 29, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[4].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 31, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[4].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 32, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[5].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 33, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[5].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 35, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 36, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 39, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[0].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 40, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 41, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 43, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 44, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[1].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 43, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 45, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 47, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[2].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 48, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 49, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 48, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 51, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[3].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 52, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 53, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 55, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[6].ChildTask[4].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 56, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+
+ taskDetails[0].ChildTask[7].ChildTask[0].Predecessor.Add(new Predecessor() { GanttTaskIndex = 57, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[7].ChildTask[1].Predecessor.Add(new Predecessor() { GanttTaskIndex = 59, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ taskDetails[0].ChildTask[7].ChildTask[2].Predecessor.Add(new Predecessor() { GanttTaskIndex = 60, GanttTaskRelationship = GanttTaskRelationship.FinishToStart });
+ return taskDetails;
+ }
+
+ ///
+ /// Gets the resources.
+ ///
+ /// The resources
+ private static ObservableCollection GetResources()
+ {
+ ObservableCollection Resources = new ObservableCollection();
+ Resources.Add(new Resource() { ID = 1, Name = "General Contractor" });
+ Resources.Add(new Resource() { ID = 2, Name = "Owner" });
+ Resources.Add(new Resource() { ID = 3, Name = "Architect" });
+ Resources.Add(new Resource() { ID = 4, Name = "Site Excavation Contractor" });
+ Resources.Add(new Resource() { ID = 5, Name = "Electrical Contractor" });
+ Resources.Add(new Resource() { ID = 6, Name = "Plumbing Contractor" });
+ Resources.Add(new Resource() { ID = 7, Name = "Concrete Contractor" });
+ Resources.Add(new Resource() { ID = 8, Name = "Inspector" });
+ Resources.Add(new Resource() { ID = 9, Name = "Framing Contractor" });
+ Resources.Add(new Resource() { ID = 10, Name = "Roofing Contractor" });
+ Resources.Add(new Resource() { ID = 11, Name = "Insulation Contractor" });
+ Resources.Add(new Resource() { ID = 12, Name = "Drywall contractor" });
+ Resources.Add(new Resource() { ID = 13, Name = "Painting Contractor" });
+ Resources.Add(new Resource() { ID = 14, Name = "Flooring Contractor" });
+ Resources.Add(new Resource() { ID = 15, Name = "Appliance Contractor" });
+ Resources.Add(new Resource() { ID = 16, Name = "Masonry Contractor" });
+ Resources.Add(new Resource() { ID = 17, Name = "Maid Service" });
+ return Resources;
+ }
+ }
+
+{% endhighlight %}
+
+{% highlight c# tabtitle="ViewModel.cs" %}
+
+public class ViewModel : TaskRepository
{
- List tasks = new List();
- /// Adding the list of tasks
- tasks.AddRange(this.GanttItemSource[0].ChildTask[0].ChildTask[2].ChildTask);
- tasks.AddRange(this.GanttItemSource[0].ChildTask[1].ChildTask);
- this.HighlightedTasks = tasks;
-}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ViewModel()
+ {
+ this.HighlightTaskItems = this.GetCriticalTasks();
+ _highlightingBrush = Brushes.Red;
+ }
+
+ private List _highlightTaskItems;
+
+ ///
+ /// Gets or sets the highlight task items.
+ ///
+ /// The highlight task items.
+ public List HighlightTaskItems
+ {
+ get
+ {
+ return _highlightTaskItems;
+ }
+ set
+ {
+ _highlightTaskItems = value;
+ RaisePropertyChanged("HighlightTaskItems");
+ }
+ }
+
+ private DateTime _startTime = new DateTime(2012, 2, 16);
+
+ ///
+ /// Gets or sets the start time.
+ ///
+ /// The start time.
+ public DateTime StartTime
+ {
+ get
+ {
+ return _startTime;
+ }
+ set
+ {
+ if (value <= _endTime || this._endTime.Equals(DateTime.MinValue))
+ {
+ _startTime = value;
+ }
+ RaisePropertyChanged("StartTime");
+ }
+ }
+
+ private DateTime _endTime = new DateTime(2012, 8, 1);
-/// Adding Highlighted items code behind
-this.Gantt.HighlightedItems = this.view.HighlightedTasks;
+ ///
+ /// Gets or sets the end time.
+ ///
+ /// The end time.
+ public DateTime EndTime
+ {
+ get
+ {
+ return _endTime;
+ }
+ set
+ {
+ _endTime = value;
+ RaisePropertyChanged("EndTime");
+ }
+ }
+ private Brush _highlightingBrush;
+
+ ///
+ /// Gets or sets the highlighting brush.
+ ///
+ /// The highlighting brush.
+ public Brush HighlightingBrush
+ {
+ get
+ {
+ return _highlightingBrush;
+ }
+ set
+ {
+ _highlightingBrush = value;
+ RaisePropertyChanged("HighlightingBrush");
+ }
+ }
+
+ #region Delegate Commands
+
+ private DelegateCommand