I want to know if its possible to update Gantt Tasks when you change a Start Date or End Date from the Grid View part. For example, if I delay Proptotype Task, all the task behind should be delayed the same time as Prototype.
What I can suggest for accomplishing this requirement would be to handle the TaskEditing and TaskEdited events.
In the TaskEditing event handler, you can preserve the previous End of the task and in the TaskEdited event, you can calculate whether the change should modify the rest of the tasks. If that is the case, you can iterate over them and modify their Start and/or End times.
private DateTime oldTaskEnd;
privatevoidOnTaskEditingCommandExecuted(object obj)
{
var args = obj as TaskEditingEventArgs;
var task = args.Task;
this.oldTaskEnd = args.Task.End;
}
privatevoidOnTaskEditedCommandExecuted(object obj)
{
var args = obj as TaskEditedEventArgs;
var updatedTask = args.Task;
if (this.oldTaskEnd < updatedTask.End)
{
var tasks = this.GanttTasks.SelectMany(t => t.Children);
foreach (var task in tasks)
{
if (task.Start > this.oldTaskEnd)
{
task.Start = task.Start.Add(updatedTask.End - this.oldTaskEnd);
task.End = task.End.Add(updatedTask.End - this.oldTaskEnd);
}
}
}
}
I've also prepared a small sample project to demonstrate this in action. You can change the End time of the "Design public API" task and notice that if you add a few days/hours to it, the rest of the tasks will be updated accordingly.
Please give this a try and let me know if such an approach would work for you.