Skip to content

Enforce task dependencies in the Gantt view of the WinForms Scheduler Control.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/winforms-scheduler-enforce-task-dependencies-gantt-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Scheduler - Enforce task dependencies in the Gantt view

This example handles the AllowAppointmentConflicts event to implement restrictions on appointment editing (appointments linked with a dependency should follow dependency rules).

If two appointments are linked with a Finish-to-Start dependency, the Finish value of the parent appointment should always be less than or equal to the Start value of the dependent appointment. The example uses GetDependenciesByDependentId and GetDependenciesByParentId methods to obtain dependency collections.

private void schedulerControl1_AllowAppointmentConflicts(object sender, AppointmentConflictEventArgs e) {
    e.Conflicts.Clear();
    AppointmentDependencyBaseCollection depCollectionDep = 
        schedulerDataStorage1.AppointmentDependencies.Items.GetDependenciesByDependentId(e.Appointment.Id);
    if (depCollectionDep.Count > 0) {
        if (CheckForInvalidDependenciesAsDependent(depCollectionDep, e.AppointmentClone))
            e.Conflicts.Add(e.AppointmentClone);
    }
    AppointmentDependencyBaseCollection depCollectionPar = 
        schedulerDataStorage1.AppointmentDependencies.Items.GetDependenciesByParentId(e.Appointment.Id);
    if (depCollectionPar.Count > 0) {
        if (CheckForInvalidDependenciesAsParent(depCollectionPar, e.AppointmentClone))
            e.Conflicts.Add(e.AppointmentClone);
    }
}

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)