How to force the parent activity's
WorkComplete property automatically updated when changes occur in its child activities?
WorkComplete value of a parent activity is highly dependent on the application requirements.
For instance, you can decide that it should be the minimum of all the child's
WorkComplete value. But in an other situation, you can decide that it should be the average value of the child
WorkComplete, or even if some child tasks are more important than others, some ponderated values.
With that in mind, the
WorkComplete behavior has not been implemented for the parent activities, which by default will remain at 0 regardless of children activities
To change this default behavior and automatically calculate the parent activity's
WorkComplete each time one child
WorkComplete is updated, you can listen to
The code below demonstrates how to set the parent activity's
WorkComplete value to the minimum value of all its child's
this.simpleGanttModel1.ActivitiesChanged += new
private void simpleGanttModel1_ActivitiesChanged(object sender,
IActivity parent = e.Activity.Parent;
IEnumerator enu = parent.ChildActivities.GetEnumerator();
if(((IActivity)enu.Current).WorkComplete <= minWorkComplete)
minWorkComplete = ((IActivity)enu.Current).WorkComplete;
The above code will work fine with activities such as
If you are using
WorkComplete value for the parent activity is set to 0, and cannot be modified.