Drag&Drop Reorder: how to avoid that a child task is dropped on a different parent node

2 posts, 0 answers
  1. Giorgio
    Giorgio avatar
    7 posts
    Member since:
    Aug 2016

    Posted 24 Mar 2017 Link to this post


    Is there a way to avoid that during the ordering a task child of a summary node is dragged under another summary node?

    I think that I have to do this overriding the GanttDragDropBehavior.CanDrop() function but I can't find how to know when the DestinationSlot changes his parent node

    Any help will be appreciated
    Thanks in advance


  2. Polya
    Polya avatar
    253 posts

    Posted 29 Mar 2017 Link to this post

    Hi Giorgio,

    You are correct in creating a custom GanttDragDropBehavior and overriding the CanDrop method. As the desired functionality does not come out of the box, I suggest creating a custom GanttTask in which you can include a property SummaryParent (of type CustomGanttTask) and set it for each non-summary task when populating the TasksSource.

    This way in the overridden CanDrop method you can check whether the SchedulingDragDropState.DestinationSlot.Start.Date and End.Date are in the range of the (SchedulingDragDropState.DraggedItem as CustomGanttTask).SummaryParent.Start and End.

    You can check our Drag and Resize Configurator example from our QSF examples for reference - http://demos.telerik.com/wpf/.

    Hope this helps.

    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top