diff --git a/wpf/Diagram/Connector/DefineConnector.md b/wpf/Diagram/Connector/DefineConnector.md
index 3228bf4e26..21a7e3a576 100644
--- a/wpf/Diagram/Connector/DefineConnector.md
+++ b/wpf/Diagram/Connector/DefineConnector.md
@@ -411,7 +411,7 @@ Connectors can be interactively drawn by clicking and dragging on the diagram su
## Connectors through data source
-Connectors are automatically generated based on the relationships defined through the data source. For more information about data source, refer to [Data Source](/wpf/diagram/datasource "DataSource").
+Connectors are automatically generated based on the relationships defined through the data source. For more information about data source, refer to [DataSource](/wpf/diagram/datasource "DataSource").
## Add connectors from stencil
@@ -421,13 +421,13 @@ For more information about adding connectors from stencil, refer to [Stencil](/w
## See Also
-[`How to apply built-in theme for node and connector?`](https://support.syncfusion.com/kb/article/9995/how-to-apply-built-in-theme-for-node-and-connector-in-wpf-diagram-sfdiagram)
+[How to apply built-in theme for node and connector?](https://support.syncfusion.com/kb/article/9995/how-to-apply-built-in-theme-for-node-and-connector-in-wpf-diagram-sfdiagram)
-[`How to decide whether to drag or draw a connection on port at runtime?`](https://support.syncfusion.com/kb/article/8538/how-to-decide-whether-to-drag-or-draw-a-connection-on-port-at-runtime-in-the-wpf-diagram)
+[How to decide whether to drag or draw a connection on port at runtime?](https://support.syncfusion.com/kb/article/8538/how-to-decide-whether-to-drag-or-draw-a-connection-on-port-at-runtime-in-the-wpf-diagram)
-[`How to customize the context menu?`](https://support.syncfusion.com/kb/article/9270/how-to-customize-the-contextmenu-in-wpf-diagram-sfdiagram)
+[How to customize the context menu?](https://support.syncfusion.com/kb/article/9270/how-to-customize-the-contextmenu-in-wpf-diagram-sfdiagram)
-[`How to create port at runtime though SetTool?`](https://support.syncfusion.com/kb/article/9967/how-to-create-port-at-runtime-through-set-tool-in-wpf-diagram-sfdiagram)
+[How to create port at runtime though SetTool?](https://support.syncfusion.com/kb/article/9967/how-to-create-port-at-runtime-through-set-tool-in-wpf-diagram-sfdiagram)
[How to customize the connection indicator style of node and port?](https://support.syncfusion.com/kb/article/10048/how-to-customize-the-connection-indicator-style-of-node-and-port-in-wpf-diagram-sfdiagram)
diff --git a/wpf/Gantt/Getting-Started_images/Getting-Started_img4.png b/wpf/Gantt/Getting-Started_images/Getting-Started_img4.png
index 2e69971fd5..b87fa84b0e 100644
Binary files a/wpf/Gantt/Getting-Started_images/Getting-Started_img4.png and b/wpf/Gantt/Getting-Started_images/Getting-Started_img4.png differ
diff --git a/wpf/Gantt/Getting-Started_images/gantt-control-appearance-and-structure.png b/wpf/Gantt/Getting-Started_images/gantt-control-appearance-and-structure.png
index 82d00c4637..21ecf1c836 100644
Binary files a/wpf/Gantt/Getting-Started_images/gantt-control-appearance-and-structure.png and b/wpf/Gantt/Getting-Started_images/gantt-control-appearance-and-structure.png differ
diff --git a/wpf/Gantt/Getting-Started_images/gantt-control-gantt-chart.png b/wpf/Gantt/Getting-Started_images/gantt-control-gantt-chart.png
index 7a51f5d089..a783aac1d0 100644
Binary files a/wpf/Gantt/Getting-Started_images/gantt-control-gantt-chart.png and b/wpf/Gantt/Getting-Started_images/gantt-control-gantt-chart.png differ
diff --git a/wpf/Gantt/Getting-Started_images/gantt-control-gantt-grid.png b/wpf/Gantt/Getting-Started_images/gantt-control-gantt-grid.png
index 11eeff1335..69dab19116 100644
Binary files a/wpf/Gantt/Getting-Started_images/gantt-control-gantt-grid.png and b/wpf/Gantt/Getting-Started_images/gantt-control-gantt-grid.png differ
diff --git a/wpf/Gantt/Holiday-Customization_images/gantt-control-holiday-customization.png b/wpf/Gantt/Holiday-Customization_images/gantt-control-holiday-customization.png
index 6f0403b161..91e7332313 100644
Binary files a/wpf/Gantt/Holiday-Customization_images/gantt-control-holiday-customization.png and b/wpf/Gantt/Holiday-Customization_images/gantt-control-holiday-customization.png differ
diff --git a/wpf/Gantt/Overview_images/gantt-control-overview.png b/wpf/Gantt/Overview_images/gantt-control-overview.png
index 08f79b30c7..d3de099c20 100644
Binary files a/wpf/Gantt/Overview_images/gantt-control-overview.png and b/wpf/Gantt/Overview_images/gantt-control-overview.png differ
diff --git a/wpf/Gantt/auto-update-hierarchy.md b/wpf/Gantt/auto-update-hierarchy.md
index 819cf90dde..5ebb9e216b 100644
--- a/wpf/Gantt/auto-update-hierarchy.md
+++ b/wpf/Gantt/auto-update-hierarchy.md
@@ -85,7 +85,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Start Date.
+ /// Gets or sets the start date.
///
public DateTime StartDate
{
@@ -101,7 +101,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Finish Date.
+ /// Gets or sets the finish date.
///
public DateTime EndDate
{
@@ -117,7 +117,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for duration value.
+ /// Gets or sets the duration value.
///
public TimeSpan Duration
{
@@ -133,7 +133,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for ID value.
+ /// Gets or sets the id value.
///
public int ID
{
@@ -149,7 +149,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Name.
+ /// Gets or sets the name.
///
public string Name
{
@@ -165,7 +165,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define progress value.
+ /// Gets or sets the progress value.
///
public double Progress
{
@@ -181,7 +181,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection ChildCollection
{
@@ -196,6 +196,9 @@ public class Task : INotifyPropertyChanged
}
}
+ ///
+ /// Method to get property changed.
+ ///
private void OnPropertyChanged(string propName)
{
if (this.PropertyChanged != null)
@@ -219,7 +222,7 @@ public class Task : INotifyPropertyChanged
public class ViewModel
{
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection TaskCollection { get; set; }
@@ -346,9 +349,21 @@ public class ViewModel
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
+
+this.ganttControl.UseAutoUpdateHierarchy = false;
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
-this.Content = ganttControl;
+
+// 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";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
+
{% endhighlight %}
{% endtabs %}
{% endcapture %}
@@ -401,7 +416,7 @@ public class Task : NotificationObject
}
///
- /// Property for duration value.
+ /// Gets or sets the duration value.
///
public TimeSpan Duration
{
@@ -435,7 +450,7 @@ public class Task : NotificationObject
}
///
- /// Property for Finish Date.
+ /// Gets or sets the finish date.
///
public DateTime EndDate
{
@@ -457,7 +472,7 @@ public class Task : NotificationObject
}
///
- /// Property for Start Date.
+ /// Gets or sets the start date.
///
public DateTime StartDate
{
@@ -483,7 +498,7 @@ public class Task : NotificationObject
}
///
- /// Property for Name value.
+ /// Gets or sets the name value.
///
public string Name
{
@@ -496,7 +511,7 @@ public class Task : NotificationObject
}
///
- /// Property for ID value.
+ /// Gets or sets the id value.
///
public int Id
{
@@ -509,7 +524,7 @@ public class Task : NotificationObject
}
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection ChildCollection
{
@@ -563,6 +578,9 @@ public class Task : NotificationObject
progress = (this.childCollection.Aggregate(0d, (cur, task) => cur + task.progress)) / this.childCollection.Count;
}
+ ///
+ /// Method to update collection changed.
+ ///
public void ChildNodesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
@@ -593,7 +611,7 @@ public class Task : NotificationObject
public class ViewModel
{
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection TaskCollection { get; set; }
@@ -723,10 +741,22 @@ public class ViewModel
{% endhighlight %}
+
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
+this.ganttControl.UseAutoUpdateHierarchy = false;
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
-this.Content = ganttControl;
+
+// 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";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
+
{% endhighlight %}
{% endtabs %}
{% endcapture %}
diff --git a/wpf/Gantt/baseline-support.md b/wpf/Gantt/baseline-support.md
index 0b817b6311..4f4623d9ae 100644
--- a/wpf/Gantt/baseline-support.md
+++ b/wpf/Gantt/baseline-support.md
@@ -92,9 +92,21 @@ The following codes illustrate this:
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
-this.Content = ganttControl;
+this.ganttControl.ShowBaseline = true;
+
+/// 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;
{% endhighlight %}
@@ -170,7 +182,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Start Date.
+ /// Gets or sets the start date.
///
public DateTime StartDate
{
@@ -186,7 +198,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Finish Date.
+ /// Gets or sets the finish date.
///
public DateTime EndDate
{
@@ -202,7 +214,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for duration value.
+ /// Gets or sets the duration value.
///
public TimeSpan Duration
{
@@ -218,7 +230,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for ID value.
+ /// Gets or sets the id value.
///
public int ID
{
@@ -234,7 +246,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Name.
+ /// Gets or sets the Name.
///
public string Name
{
@@ -250,7 +262,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define progress value.
+ /// Gets or sets the progress value.
///
public double Progress
{
@@ -266,7 +278,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Gets or sets cost.
+ /// Gets or sets the cost.
///
public Double Cost
{
@@ -282,7 +294,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Gets or sets the Baseline start.
+ /// Gets or sets the baseline start.
///
public DateTime BaselineStart
{
@@ -298,7 +310,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Gets or sets the Baseline end.
+ /// Gets or sets the baseline end.
///
public DateTime BaselineEnd
{
@@ -314,7 +326,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Gets or sets cost.
+ /// Gets or sets the baseline cost.
///
public Double BaselineCost
{
@@ -330,7 +342,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection ChildCollection
{
@@ -346,7 +358,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define resource value.
+ /// Gets or sets the resource value.
///
public ObservableCollection Resource
{
@@ -362,7 +374,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define predecessor value.
+ /// Gets or sets the predecessor value.
///
public ObservableCollection Predecessor
{
@@ -377,6 +389,9 @@ public class Task : INotifyPropertyChanged
}
}
+ ///
+ /// Method for property changed.
+ ///
private void OnPropertyChanged(string propName)
{
if (this.PropertyChanged != null)
@@ -824,11 +839,26 @@ The following codes illustrate Adding On-Demand Baseline Column Inclusion to an
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
+
// Displaying the Add new column drop down
-ganttControl.ShowAddNewColumn = true;
-this.Content = ganttControl;
+this.ganttControl.ShowAddNewColumn = true;
+
+// 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";
+taskAttributeMapping.BaselineCostMapping = "BaselineCost";
+taskAttributeMapping.BaselineFinishMapping = "BaselineEnd";
+taskAttributeMapping.BaselineStartMapping = "BaselineStart";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
{% endhighlight %}
{% endtabs %}
@@ -915,9 +945,8 @@ The following codes illustrate adding Project Statistics to an application:
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
-this.Content = ganttControl;
+
// To get the Project Statistics
ProjectInfo projInfo = this.ganttControl.GetProjectStatistics();
@@ -926,6 +955,22 @@ ProjectInfo projInfo = this.ganttControl.GetProjectStatistics();
ProjectInfo projInfo = new ProjectInfo();
projInfo = this.ganttControl.GetProjectStatistics();
+// 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";
+taskAttributeMapping.BaselineCostMapping = "BaselineCost";
+taskAttributeMapping.BaselineFinishMapping = "BaselineEnd";
+taskAttributeMapping.BaselineStartMapping = "BaselineStart";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
+
{% endhighlight %}
{% endtabs %}
diff --git a/wpf/Gantt/calendar-customization.md b/wpf/Gantt/calendar-customization.md
index 7c50657f0e..9fc4fea083 100644
--- a/wpf/Gantt/calendar-customization.md
+++ b/wpf/Gantt/calendar-customization.md
@@ -127,63 +127,60 @@ The following code illustrates adding Calendar Customization to an Application:
PredecessorMapping="Predecessor"/>
-
+
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
-CalendarCustomizationViewModel viewModel = new CalendarCustomizationViewModel();
-ganttControl.DataContext = viewModel;
-ganttControl.ItemsSource = viewModel.TaskCollection;
+this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
//To set WeekBeginsOn
-ganttControl.WeekBeginsOn = DayOfWeek.Friday;
+this.ganttControl.WeekBeginsOn = DayOfWeek.Friday;
//To set FY Numbering
-ganttControl.IsFiscalYearNumberingEnabled = true;
+this.ganttControl.IsFiscalYearNumberingEnabled = true;
//To set FiscalYearBeginsOn
-ganttControl.FiscalYearBeginsOn = Month.June;
+this.ganttControl.FiscalYearBeginsOn = Month.June;
//To set DefaultStartTime
-ganttControl.DefaultStartTime = new TimeSpan(10, 0, 0);
+this.ganttControl.DefaultStartTime = new TimeSpan(10, 0, 0);
//To set DefaultEndTime
-ganttControl.DefaultEndTime = new TimeSpan(16, 0, 0);
+this.ganttControl.DefaultEndTime = new TimeSpan(16, 0, 0);
//To set Weekends
-ganttControl.Weekends = Days.Wednesday | Days.Thursday;
+this.ganttControl.Weekends = Days.Wednesday | Days.Thursday;
//To set ShowWeekends
-ganttControl.ShowWeekends = true;
+this.ganttControl.ShowWeekends = true;
//To set ExcludeWeekends
-ganttControl.ExcludeWeekends = true;
+this.ganttControl.ExcludeWeekends = true;
//To set ShowNonWorkingHoursBackground
-ganttControl.ShowNonWorkingHoursBackground = true;
+this.ganttControl.ShowNonWorkingHoursBackground = true;
// Task attribute mapping
-TaskAttributeMapping attributes = new TaskAttributeMapping();
-attributes.TaskNameMapping = "TaskName";
-attributes.TaskIdMapping = "TaskId";
-attributes.StartDateMapping = "StartDate";
-attributes.ChildMapping = "Child";
-attributes.FinishDateMapping = "FinishDate";
-attributes.DurationMapping = "Duration";
-attributes.ProgressMapping = "Progress";
-attributes.MileStoneMapping = "IsMileStone";
-attributes.PredecessorMapping = "Predecessor";
-ganttControl.TaskAttributeMapping = attributes;
-this.Content = ganttControl;
+TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "TaskId";
+taskAttributeMapping.TaskNameMapping = "TaskName";
+taskAttributeMapping.StartDateMapping = "StartDate";
+taskAttributeMapping.ChildMapping = "Child";
+taskAttributeMapping.FinishDateMapping = "FinishDate";
+taskAttributeMapping.DurationMapping = "Duration";
+taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+taskAttributeMapping.MileStoneMapping = "IsMileStone";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
{% endhighlight %}
-{% highlight c# tabtitle="CalendarCustomizationViewModel.cs" %}
+{% highlight c# tabtitle="ViewModel.cs" %}
-public class CalendarCustomizationViewModel
+public class ViewModel
{
///
/// Holds the collection value.
@@ -254,11 +251,24 @@ public class CalendarCustomizationViewModel
}
}
+ ///
+ /// Gets or sets the show holidays collection.
+ ///
public string[] ShowHolidaysCollection { get; set; }
+
+ ///
+ /// Gets or sets the exclude holidays collection.
+ ///
public string[] ExcludeHolidaysCollection { get; set; }
+ ///
+ /// Gets or sets the show weekend collection.
+ ///
public string[] ShowWeekendsCollection { get; set; }
+ ///
+ /// Gets or sets the exclude weekend collection.
+ ///
public string[] ExcludeWeekendsCollection { get; set; }
///
@@ -270,7 +280,7 @@ public class CalendarCustomizationViewModel
///
/// Initializes a new instance of the class.
///
- public CalendarCustomizationViewModel()
+ public ViewModel()
{
_taskCollection = GetData();
ExcludeWeekendsCollection = ShowWeekendsCollection = ExcludeHolidaysCollection = ShowHolidaysCollection = FYNumbering = new string[] { "True", "False" };
diff --git a/wpf/Gantt/custom-tooltip.md b/wpf/Gantt/custom-tooltip.md
index 3428d9027a..90168646d2 100644
--- a/wpf/Gantt/custom-tooltip.md
+++ b/wpf/Gantt/custom-tooltip.md
@@ -119,19 +119,42 @@ The following code illustrates how to add a custom tooltip to the Gantt control.
ToolTipTemplate="{StaticResource toolTipTemplate}"
ItemsSource="{Binding TaskCollection}">
-
+ PredecessorMapping="Predecessor"
+ ResourceInfoMapping="Resource" />
+
+
+
{% endhighlight %}
+
+{% highlight c# %}
+
+this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
+
+// 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;
+
+{% endhighlight %}
+
{% highlight c# tabtitle="Task.cs" %}
public class Task : INotifyPropertyChanged
@@ -184,7 +207,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Start Date.
+ /// Gets or sets the start date.
///
public DateTime StartDate
{
@@ -200,7 +223,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Finish Date.
+ /// Gets or sets the finish date.
///
public DateTime EndDate
{
@@ -216,7 +239,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for duration value.
+ /// Gets or sets the duration value.
///
public TimeSpan Duration
{
@@ -232,7 +255,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for ID value.
+ /// Gets or sets the ID value.
///
public int ID
{
@@ -248,7 +271,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Name.
+ /// Gets or sets the Name.
///
public string Name
{
@@ -264,7 +287,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define progress value.
+ /// Gets or sets the progress value.
///
public double Progress
{
@@ -280,7 +303,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection ChildCollection
{
@@ -296,7 +319,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define resource value.
+ /// Gets or sets the resource value.
///
public ObservableCollection Resource
{
@@ -312,7 +335,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define predecessor value.
+ /// Gets or sets the predecessor value.
///
public ObservableCollection Predecessor
{
@@ -327,6 +350,9 @@ public class Task : INotifyPropertyChanged
}
}
+ ///
+ /// Method for property changed.
+ ///
private void OnPropertyChanged(string propName)
{
if (this.PropertyChanged != null)
@@ -344,7 +370,7 @@ public class Task : INotifyPropertyChanged
public class ViewModel
{
///
- /// Property to add task collection.
+ /// Gets or sets the task collection.
///
public ObservableCollection TaskCollection { get; set; }
diff --git a/wpf/Gantt/data-binding.md b/wpf/Gantt/data-binding.md
index cea50ceebd..918976272a 100644
--- a/wpf/Gantt/data-binding.md
+++ b/wpf/Gantt/data-binding.md
@@ -15,7 +15,7 @@ Essential Gantt for WPF includes an built-in class called TaskDetails, which is
#### Use Case Scenarios
-You can easily create the taskDetails details collection using the TaskDetails class or by creating a new class by inheriting the IGantt interface.
+You can easily create the task details collection using the TaskDetails class or by creating a new class by inheriting the IGantt interface.
Binding TaskDetails collection to Gantt Control
@@ -45,9 +45,18 @@ The following code illustrates how to bind the Task Details to the Gantt Control
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
-this.Content = ganttControl;
+
+// 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";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
{% endhighlight %}
@@ -82,7 +91,7 @@ public class ViewModel
}
///
- /// Gets the task details.
+ /// Method to get the task details.
///
///
ObservableCollection GetTaskDetails()
@@ -169,20 +178,21 @@ The following code illustrate how to map the properties using the TaskAttributeM
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
+
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
+
+// Task attribute mapping
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "ID";
+taskAttributeMapping.TaskNameMapping = "Name";
+taskAttributeMapping.StartDateMapping = "StartDate";
taskAttributeMapping.ChildMapping = "ChildCollection";
-taskAttributeMapping.DurationMapping = "Duration";
taskAttributeMapping.FinishDateMapping = "EndDate";
-taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.DurationMapping = "Duration";
taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
taskAttributeMapping.ResourceInfoMapping = "Resource";
-taskAttributeMapping.StartDateMapping = "StartDate";
-taskAttributeMapping.TaskIdMapping = "ID";
-taskAttributeMapping.TaskNameMapping = "Name";
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
-this.Content = ganttControl;
{% endhighlight %}
{% endtabs %}
@@ -213,22 +223,20 @@ The following code illustrates how to bind the external source to Gantt control:
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
// Task attribute mapping
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "ID";
+taskAttributeMapping.TaskNameMapping = "Name";
+taskAttributeMapping.StartDateMapping = "StartDate";
taskAttributeMapping.ChildMapping = "ChildCollection";
-taskAttributeMapping.DurationMapping = "Duration";
taskAttributeMapping.FinishDateMapping = "EndDate";
-taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.DurationMapping = "Duration";
taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
taskAttributeMapping.ResourceInfoMapping = "Resource";
-taskAttributeMapping.StartDateMapping = "StartDate";
-taskAttributeMapping.TaskIdMapping = "ID";
-taskAttributeMapping.TaskNameMapping = "Name";
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
-this.Content = ganttControl;
{% endhighlight %}
{% highlight c# tabtitle="Task.cs" %}
@@ -283,7 +291,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Start Date.
+ /// Gets or sets the start date.
///
public DateTime StartDate
{
@@ -299,7 +307,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Finish Date.
+ /// Gets or sets the finish date.
///
public DateTime EndDate
{
@@ -315,7 +323,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for duration value.
+ /// Gets or sets the duration value.
///
public TimeSpan Duration
{
@@ -331,7 +339,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for ID value.
+ /// Gets or sets the id value.
///
public int ID
{
@@ -347,7 +355,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Name.
+ /// Gets or sets the Name.
///
public string Name
{
@@ -363,7 +371,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define progress value.
+ /// Gets or sets the progress value.
///
public double Progress
{
@@ -379,7 +387,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection ChildCollection
{
@@ -395,7 +403,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define resource value.
+ /// Gets or sets the resource value.
///
public ObservableCollection Resource
{
@@ -411,7 +419,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define predecessor value.
+ /// Gets or sets the predecessor value.
///
public ObservableCollection Predecessor
{
@@ -426,6 +434,9 @@ public class Task : INotifyPropertyChanged
}
}
+ ///
+ /// Method for property changed.
+ ///
private void OnPropertyChanged(string propName)
{
if (this.PropertyChanged != null)
diff --git a/wpf/Gantt/dependency-relationship.md b/wpf/Gantt/dependency-relationship.md
index 800c8f9327..06af8328db 100644
--- a/wpf/Gantt/dependency-relationship.md
+++ b/wpf/Gantt/dependency-relationship.md
@@ -70,7 +70,6 @@ Specifying the Relationship between Tasks
The following code illustrates how to add the Dependency Relationship between tasks:
-
{% tabs %}
{% highlight xaml %}
@@ -95,23 +94,20 @@ The following code illustrates how to add the Dependency Relationship between ta
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
-this.Content = ganttControl;
// Task attribute mapping
TaskAttributeMapping taskAttributeMapping = new TaskAttributeMapping();
+taskAttributeMapping.TaskIdMapping = "ID";
+taskAttributeMapping.TaskNameMapping = "Name";
+taskAttributeMapping.StartDateMapping = "StartDate";
taskAttributeMapping.ChildMapping = "ChildCollection";
-taskAttributeMapping.DurationMapping = "Duration";
taskAttributeMapping.FinishDateMapping = "EndDate";
-taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.DurationMapping = "Duration";
taskAttributeMapping.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
taskAttributeMapping.ResourceInfoMapping = "Resource";
-taskAttributeMapping.StartDateMapping = "StartDate";
-taskAttributeMapping.TaskIdMapping = "ID";
-taskAttributeMapping.TaskNameMapping = "Name";
this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
-this.Content = ganttControl;
{% endhighlight %}
{% highlight c# tabtitle="Task.cs" %}
@@ -166,7 +162,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Start Date.
+ /// Gets or sets the start date.
///
public DateTime StartDate
{
@@ -182,7 +178,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Finish Date.
+ /// Gets or sets the finish date.
///
public DateTime EndDate
{
@@ -198,7 +194,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for duration value.
+ /// Gets or sets the duration value.
///
public TimeSpan Duration
{
@@ -214,7 +210,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for ID value.
+ /// Gets or sets the ID value.
///
public int ID
{
@@ -230,7 +226,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property for Name.
+ /// Gets or sets the Name.
///
public string Name
{
@@ -246,7 +242,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define progress value.
+ /// Gets or sets the progress value.
///
public double Progress
{
@@ -262,7 +258,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to add child collection.
+ /// Gets or sets the child collection.
///
public ObservableCollection ChildCollection
{
@@ -278,7 +274,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define resource value.
+ /// Gets or sets the resource value.
///
public ObservableCollection Resource
{
@@ -294,7 +290,7 @@ public class Task : INotifyPropertyChanged
}
///
- /// Property to define predecessor value.
+ /// Gets or sets the predecessor value.
///
public ObservableCollection Predecessor
{
@@ -309,6 +305,9 @@ public class Task : INotifyPropertyChanged
}
}
+ ///
+ /// Method for property changed.
+ ///
private void OnPropertyChanged(string propName)
{
if (this.PropertyChanged != null)
@@ -326,7 +325,7 @@ public class Task : INotifyPropertyChanged
public class ViewModel
{
///
- /// Property to add task collection.
+ /// Gets or sets the task collection.
///
public ObservableCollection TaskCollection { get; set; }
@@ -335,6 +334,9 @@ public class ViewModel
this.TaskCollection = this.GetDataSource();
}
+ ///
+ /// Method to get the data source.
+ ///
private ObservableCollection GetDataSource()
{
@@ -530,10 +532,23 @@ The dynamic editing of predecessor will be automatically included in the Gantt b
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
+
ViewModel viewModel = new ViewModel();
-ganttControl.ItemsSource = viewModel.TaskCollection;
-this.Content = ganttControl;
+this.ganttControl.DataContext = viewModel;
+this.ganttControl.ItemsSource = viewModel.TaskCollection;
+
+// 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;
//// The following code will illustrate how to dynamically add resource and predecessor in the underlying collection:
// To Add the Dynamic Predecessors
diff --git a/wpf/Gantt/getting-started.md b/wpf/Gantt/getting-started.md
index a992f44a4a..676781c89d 100644
--- a/wpf/Gantt/getting-started.md
+++ b/wpf/Gantt/getting-started.md
@@ -110,7 +110,7 @@ Create a collection of tasks and bind it to the newly created GanttControl as gi
-
+
@@ -119,7 +119,7 @@ Create a collection of tasks and bind it to the newly created GanttControl as gi
{% highlight c# %}
GanttControl ganttControl = new GanttControl();
-this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
+ganttControl.ItemsSource = new ViewModel().TaskDetails;
this.Content = ganttControl;
{% endhighlight %}
@@ -157,37 +157,38 @@ public class ViewModel
///
ObservableCollection GetTaskDetails()
{
- ObservableCollection task = new ObservableCollection();
- task.Add(new TaskDetails { TaskId = 1, TaskName = "Scope", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
- task[0].Child.Add(new TaskDetails { TaskId = 2, TaskName = "Determine project office scope", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d });
- task[0].Child.Add(new TaskDetails { TaskId = 3, TaskName = "Justify Project Offfice via business model", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 7), Progress = 20d });
- task[0].Child.Add(new TaskDetails { TaskId = 4, TaskName = "Secure executive sponsorship", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 20d });
- task[0].Child.Add(new TaskDetails { TaskId = 5, TaskName = "Secure complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 14), Progress = 20d });
-
- task.Add(new TaskDetails { TaskId = 6, TaskName = "Risk Assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 24), Progress = 30d });
-
- task[1].Child.Add(new TaskDetails { TaskId = 7, TaskName = "Perform risk assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 21), Progress = 20d });
- task[1].Child.Add(new TaskDetails { TaskId = 8, TaskName = "Evaluate risk assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 23), Progress = 30d });
- task[1].Child.Add(new TaskDetails { TaskId = 9, TaskName = "Prepare contingency plans", StartDate = new DateTime(2011, 7, 12), FinishDate = new DateTime(2011, 7, 24), Progress = 30d });
- task[1].Child.Add(new TaskDetails { TaskId = 10, TaskName = "Risk Assessment complete", StartDate = new DateTime(2011, 7, 15), FinishDate = new DateTime(2011, 7, 24), Progress = 30d });
-
- task.Add(new TaskDetails { TaskId = 11, TaskName = "Monitoring", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 8, 6), Progress = 40d });
- task[2].Child.Add(new TaskDetails { TaskId = 12, TaskName = "Prepare Meeting agenda", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 7, 26), Progress = 30d });
- task[2].Child.Add(new TaskDetails { TaskId = 13, TaskName = "Conduct review meeting", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 7, 30), Progress = 30d });
- task[2].Child.Add(new TaskDetails { TaskId = 14, TaskName = "Migrate critical issues", StartDate = new DateTime(2011, 7, 18), FinishDate = new DateTime(2011, 8, 2), Progress = 30d });
- task[2].Child.Add(new TaskDetails { TaskId = 15, TaskName = "Estabilish change mgmt Control", StartDate = new DateTime(2011, 8, 3), FinishDate = new DateTime(2011, 8, 6), Progress = 30d });
- task[2].Child.Add(new TaskDetails { TaskId = 16, TaskName = "Monitoring Complete", StartDate = new DateTime(2011, 8, 6), FinishDate = new DateTime(2011, 8, 6), Progress = 30d });
-
- task.Add(new TaskDetails { TaskId = 17, TaskName = "Post Implementation", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 19), Progress = 40d });
- task[3].Child.Add(new TaskDetails { TaskId = 18, TaskName = "Obtain User feedback", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 10), Progress = 30d });
- task[3].Child.Add(new TaskDetails { TaskId = 19, TaskName = "Evaluate lessons learned", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 17), Progress = 30d });
- task[3].Child.Add(new TaskDetails { TaskId = 20, TaskName = "Modify items as necessary", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 19), Progress = 30d });
- task[3].Child.Add(new TaskDetails { TaskId = 21, TaskName = "Post Implementation complete", StartDate = new DateTime(2011, 8, 19), FinishDate = new DateTime(2011, 8, 19), Progress = 30d });
-
- task[0].Resources = new ObservableCollection() { new Resource { ID = 1, Name = "John" }, new Resource { ID = 2, Name = "Neil" } };
- task[0].Child[3].Resources = new ObservableCollection() { new Resource() { ID = 3, Name = "Peter" } };
- task[1].Resources = new ObservableCollection() { new Resource() { ID = 4, Name = "David" } };
- return task;
+ ObservableCollection taskDetails = new ObservableCollection();
+
+ taskDetails.Add(new TaskDetails { TaskId = 1, TaskName = "Scope", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 40d });
+ taskDetails[0].Child.Add(new TaskDetails { TaskId = 2, TaskName = "Determine project office scope", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 5), Progress = 20d });
+ taskDetails[0].Child.Add(new TaskDetails { TaskId = 3, TaskName = "Justify Project Offfice via business model", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 7), Progress = 20d });
+ taskDetails[0].Child.Add(new TaskDetails { TaskId = 4, TaskName = "Secure executive sponsorship", StartDate = new DateTime(2011, 7, 3), FinishDate = new DateTime(2011, 7, 14), Progress = 20d });
+ taskDetails[0].Child.Add(new TaskDetails { TaskId = 5, TaskName = "Secure complete", StartDate = new DateTime(2011, 7, 14), FinishDate = new DateTime(2011, 7, 14), Progress = 20d });
+
+ taskDetails.Add(new TaskDetails { TaskId = 6, TaskName = "Risk Assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 24), Progress = 30d });
+
+ taskDetails[1].Child.Add(new TaskDetails { TaskId = 7, TaskName = "Perform risk assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 21), Progress = 20d });
+ taskDetails[1].Child.Add(new TaskDetails { TaskId = 8, TaskName = "Evaluate risk assessment", StartDate = new DateTime(2011, 7, 8), FinishDate = new DateTime(2011, 7, 23), Progress = 30d });
+ taskDetails[1].Child.Add(new TaskDetails { TaskId = 9, TaskName = "Prepare contingency plans", StartDate = new DateTime(2011, 7, 12), FinishDate = new DateTime(2011, 7, 24), Progress = 30d });
+ taskDetails[1].Child.Add(new TaskDetails { TaskId = 10, TaskName = "Risk Assessment complete", StartDate = new DateTime(2011, 7, 15), FinishDate = new DateTime(2011, 7, 24), Progress = 30d });
+
+ taskDetails.Add(new TaskDetails { TaskId = 11, TaskName = "Monitoring", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 8, 6), Progress = 40d });
+ taskDetails[2].Child.Add(new TaskDetails { TaskId = 12, TaskName = "Prepare Meeting agenda", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 7, 26), Progress = 30d });
+ taskDetails[2].Child.Add(new TaskDetails { TaskId = 13, TaskName = "Conduct review meeting", StartDate = new DateTime(2011, 7, 13), FinishDate = new DateTime(2011, 7, 30), Progress = 30d });
+ taskDetails[2].Child.Add(new TaskDetails { TaskId = 14, TaskName = "Migrate critical issues", StartDate = new DateTime(2011, 7, 18), FinishDate = new DateTime(2011, 8, 2), Progress = 30d });
+ taskDetails[2].Child.Add(new TaskDetails { TaskId = 15, TaskName = "Estabilish change mgmt Control", StartDate = new DateTime(2011, 8, 3), FinishDate = new DateTime(2011, 8, 6), Progress = 30d });
+ taskDetails[2].Child.Add(new TaskDetails { TaskId = 16, TaskName = "Monitoring Complete", StartDate = new DateTime(2011, 8, 6), FinishDate = new DateTime(2011, 8, 6), Progress = 30d });
+
+ taskDetails.Add(new TaskDetails { TaskId = 17, TaskName = "Post Implementation", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 19), Progress = 40d });
+ taskDetails[3].Child.Add(new TaskDetails { TaskId = 18, TaskName = "Obtain User feedback", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 10), Progress = 30d });
+ taskDetails[3].Child.Add(new TaskDetails { TaskId = 19, TaskName = "Evaluate lessons learned", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 17), Progress = 30d });
+ taskDetails[3].Child.Add(new TaskDetails { TaskId = 20, TaskName = "Modify items as necessary", StartDate = new DateTime(2011, 8, 7), FinishDate = new DateTime(2011, 8, 19), Progress = 30d });
+ taskDetails[3].Child.Add(new TaskDetails { TaskId = 21, TaskName = "Post Implementation complete", StartDate = new DateTime(2011, 8, 19), FinishDate = new DateTime(2011, 8, 19), Progress = 30d });
+
+ 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" } };
+ return taskDetails;
}
}
@@ -307,10 +308,8 @@ To show the date with time in the GanttGrid, enable the ShowDateWithTime propert
{% endhighlight %}
{% highlight c# %}
-GanttControl ganttControl = new GanttControl();
-ganttControl.ShowDateWithTime = true;
+this.ganttControl.ShowDateWithTime = true;
this.ganttControl.ItemsSource = new ViewModel().TaskDetails;
-this.Content = ganttControl;
{% endhighlight %}
{% endtabs %}
@@ -334,7 +333,9 @@ By default, the `GanttGrid` items will be in expanded state. You can define how
{% endhighlight %}
{% highlight c# %}
+
this.ganttControl.AutoExpandMode = GanttAutoExpandMode.None;
+
{% endhighlight %}
{% endtabs %}
diff --git a/wpf/Gantt/holidays-customization.md b/wpf/Gantt/holidays-customization.md
index c43e1ec06f..be6cb6b1ec 100644
--- a/wpf/Gantt/holidays-customization.md
+++ b/wpf/Gantt/holidays-customization.md
@@ -32,36 +32,55 @@ The following code sample demonstrates how to define the holidays.
{% tabs %}
{% highlight xaml %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{% endhighlight %}
{% highlight c# %}
+this.ganttControl.ItemsSource = new ViewModel().TaskCollection;
+this.ganttControl.ShowHolidays = true;
+this.ganttControl.ExcludeHolidays = false;
+
+// 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.ProgressMapping = "Progress";
+taskAttributeMapping.PredecessorMapping = "Predecessor";
+taskAttributeMapping.ResourceInfoMapping = "Resource";
+this.ganttControl.TaskAttributeMapping = taskAttributeMapping;
+
public partial class MainWindow : Window
{
ViewModel viewModel;
@@ -81,10 +100,10 @@ public partial class MainWindow : Window
gantt.ExcludeHolidays = false;
gantt.Holidays = new GanttHolidayCollection
{
- new GanttHoliday { Day = new DateTime(2010, 6, 10), Background = Brushes.CadetBlue },
- new GanttHoliday { Day = new DateTime(2010, 7, 8), Background = Brushes.CadetBlue },
- new GanttHoliday { Day = new DateTime(2010, 8, 3), Background = Brushes.CadetBlue },
- new GanttHoliday { Day = new DateTime(2010, 9, 20), Background = Brushes.CadetBlue }
+ new GanttHoliday { Day = new DateTime(2011, 6, 10), Background = Brushes.CadetBlue },
+ new GanttHoliday { Day = new DateTime(2011, 7, 8), Background = Brushes.CadetBlue },
+ new GanttHoliday { Day = new DateTime(2011, 8, 3), Background = Brushes.CadetBlue },
+ new GanttHoliday { Day = new DateTime(2011, 9, 20), Background = Brushes.CadetBlue }
};
this.AddChild(gantt);
@@ -92,6 +111,115 @@ public partial class MainWindow : Window
}
{% 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 gets the data.
+ ///
+ ///
+ 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 %}
The following screenshot illustrates the customized holidays sample.