Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
565
Dependencies and Constraints ASAP
posted

Hi,

In the grid section I will be displaying the Dependencies column without the Constraint Type and Constraint Date columns.
Now, lets say the user has two tasks, and adds a dependency, so that the second task depends on the first task.

I would like to accomplish the following:
1. The user will be free to drag the first task to the left, and the second task will have to be dragged with it and not hang behind, as it does now because of the constraint.
2. When the user removes the dependency, the task will remain in its place and will not jump to a different location as it does now.

Is there a way to disable/ignore the constraints so it will not cause this unexpected behavior ?

If it isn't possible, how do I accomplish all this through code ? Maybe through an event ?

For number one, once a dependency is set by the user I will have to change the constraint type to "As Soon As Possible".
For number two, once the dependency is removed I will have to change the Constraint Date and Constraint Type to the task's StartDate as it was before the dependency was removed. (Once the dependency is removed why does it changes the task's StartDate ?)

Thanks in advance.

  • 53790
    posted

    Hello Kal,

    Kal said:

    1. The user will be free to drag the first task to the left, and the second task will have to be dragged with it and not hang behind, as it does now because of the constraint.

    2. When the user removes the dependency, the task will remain in its place and will not jump to a different location as it does now.

    The mentioned behavior is by design, but if you want to acheive your requirements, maybe you could try to handle  ultraGanttView1_InitializeTaskGridRow() event and modify your StartDateTime and ConstraintDateTime properties of your dependencies tasks. By this way when you drag your first task, your second task will follow it. Also when you set the StartDateTime, you will be able to remove your dependecy and you second task will keep current position.

     

    private void ultraGanttView1_InitializeTaskGridRow(object sender, Infragistics.Win.UltraWinGanttView.InitializeTaskGridRowEventArgs e)

            {

          if (e.Task == null) return;

               var  tasks = ultraCalendarInfo1.Tasks.Where(p => p.Dependencies.Contains(e.Task));

               foreach (Task task in tasks)

                {

                    task.ConstraintDateTime = e.Task.ConstraintDateTime.AddDays(2);

                    task.StartDateTime = e.Task.ConstraintDateTime.AddDays(2);

                }

            }

    Kal said:

    Is there a way to disable/ignore the constraints so it will not cause this unexpected behavior ?

    No, at that moment we have not such functionality

    Kal said:

    If it isn't possible, how do I accomplish all this through code ? Maybe through an event ?

    Yes, Maybe one possible approach could be the mentioned solution above.

     

    Please take a look at the attached video file with my suggestion and please feel free to write me if you have anny questions.

    Regards

     

    Video232.rar