Dependencies
- 2 minutes to read
This topic describes the visual AppointmentDependency element, and lists several properties that affect its visual appearance.
The Gantt View can show relationships between tasks (appointments). These relationships are called task (appointment) dependencies. They indicate dependency criteria based on which tasks begin and end in relation to each other. For example, the Finish-to-Start dependency means that the second task may not start before the first task is finished.
Appointment dependency is graphically depicted as a line with an arrow at one end, drawn between appointments on the Scheduler surface. The appointment at the head of the arrow is the dependent appointment, and the appointment at the tail of the arrow is the parent appointment.
You can create a dependency using the appointment context menu. Right-click an appointment, select Create Dependency, and drag the line to the dependent appointment.
To change the dependency type, double-click the dependency line. The SchedulerControl.EditAppointmentDependencyFormShowing event occurs and the AppointmentDependencyForm dialog is invoked. The dialog enables you to specify the AppointmentDependencyType.
To specify the visual appearance of dependencies in the view, use the corresponding SchedulerControl.GanttView.Appearance.Dependency and SchedulerControl.GanttView.Appearance.SelectedDependency settings. To learn more about appearances, refer to the Appearances document.
You can draw individual dependencies manually by handling the SchedulerControl.CustomDrawDependency event.
A dependency is an AppointmentDependency object contained within the AppointmentDependencyStorage.
Note
To support dependencies, the Scheduler should work in bound mode with the proper data mappings.
The AppointmentDependencyMappingInfo and AppointmentDependencyCustomFieldMappingCollection specify how data source fields are mapped to dependency properties. In the Visual Studio designer, you can utilize the Mapping Wizard to specify mappings.
The currently selected dependencies are available via the SchedulerControl.SelectedDependencies property.
Use the SchedulerHitTest.AppointmentDependency value to check for the dependency element in the hit test (using the SchedulerViewInfoBase.CalcHitInfo method).
The SchedulerStorageBase.AppointmentDependencyInserting, SchedulerStorageBase.AppointmentDependencyDeleting, SchedulerStorageBase.AppointmentDependenciesInserted, SchedulerStorageBase.AppointmentDependenciesChanged, and SchedulerStorageBase.AppointmentDependenciesDeleted events enable you to control dependency modifications.
By default, dependencies do not impose restrictions on appointment start and finish values. You can enable constraints manually by handling the SchedulerControl.AllowAppointmentConflicts event.