Draw relation event in Gantt View

4 posts, 0 answers
  1. Prolay
    Prolay avatar
    27 posts
    Member since:
    Nov 2012

    Posted 21 Dec 2012 Link to this post

    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
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 27 Dec 2012 Link to this post

    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.

  3. DevCraft banner
  4. Prolay
    Prolay avatar
    27 posts
    Member since:
    Nov 2012

    Posted 27 Dec 2012 Link to this post

    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
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 27 Dec 2012 Link to this post

    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.

Back to Top