Back to Devexpress

GanttControlOptionsBehavior.UpdateDependentTaskProgress Property

windowsforms-devexpress-dot-xtragantt-dot-options-dot-ganttcontroloptionsbehavior-fb8c0974.md

latest5.3 KB
Original Source

GanttControlOptionsBehavior.UpdateDependentTaskProgress Property

Gets or sets whether the control updates the progress of dependent tasks (summaries and sub-tasks) when a user modifies a task’s progress.

Namespace : DevExpress.XtraGantt.Options

Assembly : DevExpress.XtraGantt.v25.2.dll

NuGet Package : DevExpress.Win.Gantt

Declaration

csharp
[DefaultValue(DefaultBoolean.Default)]
[XtraSerializableProperty]
public DefaultBoolean UpdateDependentTaskProgress { get; set; }
vb
<XtraSerializableProperty>
<DefaultValue(DefaultBoolean.Default)>
Public Property UpdateDependentTaskProgress As DefaultBoolean

Property Value

TypeDefaultDescription
DefaultBooleanDefault

true to update the progress of dependent tasks when changes are made; otherwise, false.

|

Available values:

NameDescriptionReturn Value
True

The value is true.

|

0

| | False |

The value is false.

|

1

| | Default |

The value is specified by a global option or a higher-level object.

|

2

|

Property Paths

You can access this nested property as listed below:

Object TypePath to UpdateDependentTaskProgress
GanttControl

.OptionsBehavior .UpdateDependentTaskProgress

|

Remarks

If the UpdateDependentTaskProgress option is enabled, the control automatically recalculates the progress when changes are made. For example, when a user modifies a particular task’s progress, the control updates the progress of all dependent tasks:

  • for a regular task — the control recalculates the progress for all summary tasks (the total progress).

  • for a summary task (the total progress) — the control recalculates the progress for all sub-tasks and parent summary tasks.

The CustomTaskProgress event fires when the control recalculated a dependent task’s progress. You can handle this event to specify a custom value.

If the UpdateDependentTaskProgress option is disabled or if you updated progress in the data source, the control does not update progress in dependent tasks. You can call the UpdateSummaryProgress method to update progress for all summary tasks in a tree branch that starts from the specified task. If the summary task is not specified, the method updates all tasks in the project.

See Task Progress for more information.

Example

The code below handles the CustomTaskProgress event to apply a coefficient to the contribution of a particular task to the total progress.

csharp
ganttControl1.CustomTaskProgress += GanttControl1_CustomTaskProgress;

private void GanttControl1_CustomTaskProgress(object sender, DevExpress.XtraGantt.CustomTaskProgressEventArgs e) {
    if(e.Node.HasChildren) {
        float result = 0;
        foreach(GanttControlNode node in e.Node.Nodes)
            result += (float)node["Progress"] / 100 * (float)node["ProgressCoefficient"];
        e.Progress = result;
    }
}
vb
AddHandler ganttControl1.CustomTaskProgress, AddressOf GanttControl1_CustomTaskProgress

Private Sub GanttControl1_CustomTaskProgress(ByVal sender As Object, ByVal e As DevExpress.XtraGantt.CustomTaskProgressEventArgs)
    If e.Node.HasChildren Then
        Dim result As Single = 0
        For Each node As GanttControlNode In e.Node.Nodes
            result += DirectCast(node("Progress"), Single) / 100 * DirectCast(node("ProgressCoefficient"), Single)
        Next node
        e.Progress = result
    End If
End Sub

See Also

Task Progress

ProgressFieldName

CustomTaskProgress

UpdateSummaryProgress(GanttControlNode)

AllowModifyProgress

GanttControlOptionsBehavior Class

GanttControlOptionsBehavior Members

DevExpress.XtraGantt.Options Namespace