This is a migrated thread and some comments may be shown as answers.

Draw relation event in Gantt View

3 Answers 61 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Prolay
Top achievements
Rank 1
Prolay asked on 21 Dec 2012, 01:21 PM
Hi,

I need to handle the draw relation event to save the new created relation to database. What is the event i shall look for? 


Thanks and Regards
Prolay

3 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 27 Dec 2012, 09:33 AM
Hi Prolay,

There is no event raised when a relation is being created. To create a dependency from one task to another, the GanttView calls the AddDependency method of the IDependant interface. It already has an implementation in the GanttTask class, but if you are using custom tasks you should implement it yourself and put the dependency in the database when this method is called.

Hope this helps.

Greetings,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Prolay
Top achievements
Rank 1
answered on 27 Dec 2012, 12:58 PM
Hi Miroslav,
 

I have extended the GanttTask class like this GanttTaskNew : GanttTask

So can you provide some code on how this can be achieved as i have tried doing something like this in the GanttTaskNew class but this doesn't work.

public new IDependency AddDependency(IGanttTask fromTask, DependencyType type)
{
     return base.AddDependency(fromTask, type);
}
 

Regards,

Prolay
0
Miroslav Nedyalkov
Telerik team
answered on 27 Dec 2012, 03:56 PM
Hi Prolay,

The suggested approach doesn't work if you are using the GanttTask class - it only works if you are creating a custom implementation of the interface. In the case you are using the default GanttTask class I would suggest you to cast the Dependencies property of the task to INotifyCollectionChanged and to hook to its CollectionChanged event - it will be fired when the Dependencies are changed (including if the user draws a relation with the mouse).

Hope this helps.

Greetings,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GanttView
Asked by
Prolay
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Prolay
Top achievements
Rank 1
Share this question
or