Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 20 additions & 20 deletions wpf/Gantt/auto-update-hierarchy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documentation: ug

# Auto Update Hierarchy in WPF Gantt

Essential Gantt provides support for auto updating hierarchy, in which the Gantt control will listen to the change in child tasks/activities and automatically update them in the parent task/activity accordingly. There is no need to have any custom logics in business objects to update the hierarchy. You can enable or disable this functionality by using the UseAutoUpdateHierarchy property.
Essential Gantt provides support for auto updating hierarchy, in which the Gantt control will listen to the change in child tasks/activities and automatically update them in the parent task/activity accordingly. There is no need to have any custom logics in business objects to update the hierarchy. You can enable or disable this functionality by using the [UseAutoUpdateHierarchy](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_UseAutoUpdateHierarchy) property.

## Use Case Scenario

Expand Down Expand Up @@ -430,22 +430,22 @@ public class Task : NotificationObject
}

/// The difference between the end date and starting date is calculated exactly.
duration = endDate.Subtract(startDate);
return duration;
this.duration = endDate.Subtract(startDate);
return this.duration;
}
set
{
if (this.childCollection != null && this.childCollection.Count >= 1)
{
var sum = new TimeSpan(0, 0, 0, 0);
sum = this.childCollection.Aggregate(sum, (current, task) => current + task.Duration);
duration = sum;
this.duration = sum;
return;
}

duration = value;
/// The end date is calculated to make the change in end date based on duration. The duration is interlinked with the starting date and end date, so it will affect the both based on the changes.
EndDate = startDate.AddDays(Double.Parse(duration.TotalDays.ToString()));
this.EndDate = this.startDate.AddDays(Double.Parse(this.duration.TotalDays.ToString()));
}
}

Expand All @@ -454,17 +454,17 @@ public class Task : NotificationObject
/// </summary>
public DateTime EndDate
{
get { return endDate; }
get { return this.endDate; }
set
{
if (this.childCollection != null && this.childCollection.Count >= 1)
{
/// If this task is a parent task, then it should have the maximum end time to compare the date with maximum date of its child tasks.
if (value >= this.childCollection.Max(s => s.EndDate) && endDate != value)
endDate = value;
if (value >= this.childCollection.Max(s => s.EndDate) && this.endDate != value)
this.endDate = value;
}
else
endDate = value;
this.endDate = value;
RaisePropertyChanged("EndDate");
/// The changed duration is invoked to notify the change in duration based on the new end date.
RaisePropertyChanged("Duration");
Expand All @@ -478,19 +478,19 @@ public class Task : NotificationObject
{
get
{
return startDate;
return this.startDate;
}
set
{
/// If this task is a parent task, then it should have the minimum starting time to compare the date with minimum date of its child tasks.

if (this.childCollection != null && this.childCollection.Count >= 1)
{
if (value <= this.childCollection.Min(s => s.startDate) && startDate != value)
startDate = value;
if (value <= this.childCollection.Min(s => s.startDate) && this.startDate != value)
this.startDate = value;
}
else
startDate = value;
this.startDate = value;
RaisePropertyChanged("startDate");
/// The changed duration is invoked to notify the change in duration based on the new start date.
RaisePropertyChanged("Duration");
Expand All @@ -502,10 +502,10 @@ public class Task : NotificationObject
/// </summary>
public string Name
{
get { return name; }
get { return this.name; }
set
{
name = value;
this.name = value;
RaisePropertyChanged("Name");
}
}
Expand All @@ -515,10 +515,10 @@ public class Task : NotificationObject
/// </summary>
public int Id
{
get { return id; }
get { return this.id; }
set
{
id = value;
this.id = value;
RaisePropertyChanged("Id");
}
}
Expand Down Expand Up @@ -573,9 +573,9 @@ public class Task : NotificationObject
private void UpdateData()
{
/// Update the starting date and end date based on the changes made in the date of child tasks.
StartDate = this.childCollection.Select(c => c.startDate).Min();
EndDate = this.childCollection.Select(c => c.EndDate).Max();
progress = (this.childCollection.Aggregate(0d, (cur, task) => cur + task.progress)) / this.childCollection.Count;
this.StartDate = this.childCollection.Select(c => c.startDate).Min();
this.EndDate = this.childCollection.Select(c => c.EndDate).Max();
this.progress = (this.childCollection.Aggregate(0d, (cur, task) => cur + task.progress)) / this.childCollection.Count;
}

/// <summary>
Expand Down
25 changes: 11 additions & 14 deletions wpf/Gantt/baseline-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ Type </th><th>
Return Type </th></tr>
<tr>
<td>
LoadVarianceTableView</td><td>
[LoadVarianceTableView](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_LoadVarianceTableView)</td><td>
this method is used to load the Variance view of the Gantt.</td><td>
LoadVarianceTableView()</td><td>
N/A</td><td>
void </td></tr>
<tr>
<td>
LoadDefaultTableView</td><td>
[LoadDefaultTableView](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_LoadDefaultTableView)</td><td>
this method is used to load the Default (Editing) view of the Gantt.</td><td>
LoadDefaultTableView()</td><td>
N/A</td><td>
Expand All @@ -57,8 +57,8 @@ To add Baseline Table View to an application:

1. Declare the baseline properties in the view model.
2. Map the properties to Gantt in the corresponding TaskAttributeMappingProperty.
3. To load the Variance view, call the LoadVarianceTableView() method of the Gantt.
4. To load the Default (Editing) view, call the LoadDefaultTableView() method of the Gantt.
3. To load the Variance view, call the [LoadVarianceTableView](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_LoadVarianceTableView) method of the Gantt.
4. To load the Default (Editing) view, call the [LoadDefaultTableView](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_LoadDefaultTableView) method of the Gantt.

The following codes illustrate this:

Expand Down Expand Up @@ -451,7 +451,6 @@ public class ViewModel
taskDetails.Add(new Task() { ID = 1, Name = "Residential Construction (2500 sq.ft)", StartDate = new DateTime(2012, 3, 1), EndDate = new DateTime(2012, 3, 15), BaselineStart = new DateTime(2012, 3, 1), BaselineEnd = new DateTime(2012, 3, 14), Progress = 0d, Cost = 500, BaselineCost = 833d, });

taskDetails[0].ChildCollection.Add(new Task() { ID = 2, Name = "General Considerations", StartDate = new DateTime(2012, 7, 3), EndDate = new DateTime(2012, 7, 14), BaselineStart = new DateTime(2012, 7, 3), BaselineEnd = new DateTime(2012, 7, 14), Progress = 0d, Cost = 89, BaselineCost = 833d, });

taskDetails[0].ChildCollection[0].ChildCollection.Add(new Task() { ID = 3, Name = "Finalize and Approve Plans", StartDate = new DateTime(2012, 3, 1), EndDate = new DateTime(2012, 3, 15), BaselineStart = new DateTime(2012, 3, 2), BaselineEnd = new DateTime(2012, 3, 16), Progress = 0d, Cost = 500, BaselineCost = 833d, });
taskDetails[0].ChildCollection[0].ChildCollection[0].ChildCollection.Add(new Task() { ID = 4, Name = "Review and Finalize Site Plans", StartDate = new DateTime(2012, 3, 1), EndDate = new DateTime(2012, 3, 20), BaselineStart = new DateTime(2012, 3, 1), BaselineEnd = new DateTime(2012, 3, 20), Progress = 0d, Cost = 500, BaselineCost = 833d, });
taskDetails[0].ChildCollection[0].ChildCollection[0].ChildCollection.Add(new Task() { ID = 5, Name = "Sign contract and Proceed", StartDate = new DateTime(2012, 3, 20), EndDate = new DateTime(2012, 3, 22), BaselineStart = new DateTime(2012, 3, 19), BaselineEnd = new DateTime(2012, 3, 21), Progress = 0d, Cost = 500, BaselineCost = 833d, });
Expand Down Expand Up @@ -501,7 +500,6 @@ public class ViewModel
taskDetails[0].ChildCollection[6].ChildCollection[0].ChildCollection.Add(new Task() { ID = 40, Name = "Install Wall Insulation", StartDate = new DateTime(2012, 6, 19), EndDate = new DateTime(2012, 6, 21), BaselineStart = new DateTime(2012, 6, 19), BaselineEnd = new DateTime(2012, 6, 21), Progress = 0d, Cost = 53, BaselineCost = 83d, });
taskDetails[0].ChildCollection[6].ChildCollection[0].ChildCollection.Add(new Task() { ID = 41, Name = "Install Ceiling Insulation", StartDate = new DateTime(2012, 6, 21), EndDate = new DateTime(2012, 6, 22), BaselineStart = new DateTime(2012, 6, 21), BaselineEnd = new DateTime(2012, 6, 22), Progress = 0d, Cost = 89, BaselineCost = 83d, });


taskDetails[0].ChildCollection[6].ChildCollection.Add(new Task() { ID = 42, Name = "Painting and Wallpaper", StartDate = new DateTime(2012, 6, 22), EndDate = new DateTime(2012, 6, 23), BaselineStart = new DateTime(2012, 6, 22), BaselineEnd = new DateTime(2012, 6, 23), Progress = 0d, Cost = 453, BaselineCost = 563, });
taskDetails[0].ChildCollection[6].ChildCollection[1].ChildCollection.Add(new Task() { ID = 43, Name = "Painting all Interior", StartDate = new DateTime(2012, 6, 22), EndDate = new DateTime(2012, 6, 23), BaselineStart = new DateTime(2012, 6, 22), BaselineEnd = new DateTime(2012, 6, 23), Progress = 0d, Cost = 453, BaselineCost = 563, });
taskDetails[0].ChildCollection[6].ChildCollection[1].ChildCollection.Add(new Task() { ID = 44, Name = "Painting all Exterior", StartDate = new DateTime(2012, 6, 23), EndDate = new DateTime(2012, 6, 25), BaselineStart = new DateTime(2012, 6, 23), BaselineEnd = new DateTime(2012, 6, 25), Progress = 0d, Cost = 352, BaselineCost = 342, });
Expand All @@ -527,7 +525,6 @@ public class ViewModel
taskDetails[0].ChildCollection[7].ChildCollection.Add(new Task() { ID = 60, Name = "Final Inspection", StartDate = new DateTime(2012, 7, 16), EndDate = new DateTime(2012, 7, 17), BaselineStart = new DateTime(2012, 7, 16), BaselineEnd = new DateTime(2012, 7, 17), Progress = 0d, Cost = 0, BaselineCost = 5, });
taskDetails[0].ChildCollection[7].ChildCollection.Add(new Task() { ID = 61, Name = "Move In", StartDate = new DateTime(2012, 7, 17), EndDate = new DateTime(2012, 7, 17), BaselineStart = new DateTime(2012, 7, 18), BaselineEnd = new DateTime(2012, 7, 18), Progress = 0d, Cost = 0, BaselineCost = 0, });


//Adding Resources
taskDetails[0].ChildCollection[0].ChildCollection[0].ChildCollection[0].Resource.Add(ResidentialConstructionResources[1]);
taskDetails[0].ChildCollection[0].ChildCollection[0].ChildCollection[0].Resource.Add(ResidentialConstructionResources[0]);
Expand Down Expand Up @@ -715,7 +712,7 @@ Data Type</th><th>
Reference links</th></tr>
<tr>
<td>
ShowBaseline</td><td>
[ShowBaseline](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_ShowBaseline)</td><td>
Controls the view of baseline in the Gantt Chart. Default value is false</td><td>
DependencyProperty</td><td>
bool</td><td>
Expand All @@ -738,14 +735,14 @@ Data Type</th><th>
Reference links</th></tr>
<tr>
<td>
BaselineColor</td><td>
[BaselineColor](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_BaselineColor)</td><td>
Used to customize the baseline color. Default value is Orange</td><td>
DependencyProperty</td><td>
Brush</td><td>
NA</td></tr>
<tr>
<td>
BaselineStrokeThickness</td><td>
[BaselineStrokeThickness](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_BaselineStrokeThickness)</td><td>
Used to customize the baseline thickness. Default value is 3d</td><td>
DependencyProperty</td><td>
bool</td><td>
Expand Down Expand Up @@ -792,7 +789,7 @@ Type </th><th>
Data Type </th></tr>
<tr>
<td>
ShowAddNewColumn</td><td>
[ShowAddNewColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_ShowAddNewColumn)</td><td>
Gets/Sets the value that is used in displaying/hiding the add new column combo box in grid</td><td>
DependencyProperty </td><td>
bool</td></tr>
Expand All @@ -803,8 +800,8 @@ Adding On-Demand Baseline Column Inclusion to an Application

To add the On-Demand Baseline Column Inclusion to an application you need to enable the AddNewColumn of Gantt Grid, which will have a drop down cell on its head, which in turn will have the baseline columns that can be added dynamically. To enable this feature:

1. To show the Add New Column of Gantt Grid, set the ShowAddNewColumn Property to true in Gantt.
2. To include the Baseline columns in the Add New Columns drop down cell, provide the corresponding mapping name in TaskAttributeMapping.
1. To show the Add New Column of Gantt Grid, set the [ShowAddNewColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_ShowAddNewColumn) Property to true in Gantt.
2. To include the Baseline columns in the Add New Columns drop down cell, provide the corresponding mapping name in [TaskAttributeMapping](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.TaskAttributeMapping.html).
3. Mapped Baseline columns will be listed in the drop down cell.
4. By selecting a column name from the drop down cell, the corresponding column will be dynamically added to the Gantt Grid.

Expand Down Expand Up @@ -898,7 +895,7 @@ Type </th><th>
Return Type </th></tr>
<tr>
<td>
GetProjectStatistics</td><td>
[GetProjectStatistics](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Gantt.GanttControl.html#Syncfusion_Windows_Controls_Gantt_GanttControl_GetProjectStatistics)</td><td>
this method is used to get the current statistics information about the project</td><td>
GetProjectStatistics()</td><td>
N/A</td><td>
Expand Down
Loading