GanttView allows you to define constraints which can be defined as restriction on the start or finish date of a task. You can easily assign a constraint type and constraint date to a task which it must adhere to when scheduling in automatic mode. You can add task constraints for each task using the ConstraintType and ConstraintDate properties of the Task class. The ConstraintType uses ConstraintType enum to set the type of constraint to one of the following values:
Constraint Type | Description |
---|---|
Default | No constraint. |
StartNoEarlierThan | Specifies the earliest start date for the task. Use this constraint to make sure the task does not start before a specified date. This constraint is selected by default if the task is a successor. |
StartNoLaterThan | Specifies the latest start date for the task. Use this constraint to make sure the task does not start after a specified date. This constraint is selected by default if the task is a predecessor. |
FinishNoEarlierThan | Specifies the earliest finish date for the task. Use this constraint to make sure the task does not finish before a certain date. |
FinishNoLaterThan | Specifies the latest finish date for the task. Use this constraint to make sure the task does not finish after a certain date. |
MustStartOn | Specifies the date the task must begin. |
MustFinishOn | Specifies the date the task must end. |
Use the below code to define constraint type and constraint date in the GanttView control.
C# |
Copy Code
|
---|---|
//Set ConstraintType and ConstraintDate Task1.ConstraintDate = new DateTime(2021, 06, 7); Task1.ConstraintType = ConstraintType.MustStartOn; Task1.Duration = 4; |