Custom drag behavior providing alternative to-Finish dependency constraints within Gantt Chart Library and Project Management Library for WPF

By design and by default, when the end user drags and drops task bars in the Gantt Chart area, dependency constraints are applied within a standard task property change strategy indicated below:

  1. Start property value of the dependent task is changed during the drag and drop operation execution;
  2. When Start changes, Finish property value is updated in order to preserve task duration;
  3. Start and finish constraints are applied:

As one can notice, in some scenarios, the default strategy may not be appropriate because:

To show you how you can resolve both thse issues, we have prepared sample code that further customizes the drag and drop behavior offered as a feature of the internal TaskDragThumb objects used in the default standard task template. You should apply the extra code to your application, whenever the default property value change strategy is not fully appropriate for your project: Custom Drag Behavior sample.

Note that the code in this sample only updates the task bar drag and drop behavior in order to add alternative support for to-Finish dependency constraints, and it doesn't apply similar constraints when the user sets Start and Finish values of dependent tasks in the data grid. In order to obtain consistency within your application, consider validating Start and Finish values of tasks when they change in the grid also, such as by customizing the column templates and adding custom code on edit control or Binding validation events.