Drag&Drop Reorder: Disable "After" and "Inside"

3 posts, 0 answers
  1. Ludwig
    Ludwig avatar
    10 posts
    Member since:
    Oct 2014

    Posted 05 Nov Link to this post

    Hello!

    At the Reorder-Drag&Drop there are 3 options to reorder the Tasks: "Before", "Inside" and "After". Is there a possibility to disable "Inside" and "After", so the user only has the option to reorder "Before"?

     

    kind regards

    Ludwig

  2. Polya
    Admin
    Polya avatar
    200 posts

    Posted 07 Nov Link to this post

    Hi Ludwig,

    In order to disable the drop inside and after a GanttTask we should create a custom GanttDragDropBehavior and override the GetReorderDropPosition method. This method determines the drop position depending on the overlapping value, so if we only return DropRelativePosition.Before the user would not be able to drop inside or after a GanttTask:

    public class CustomDragDropBehavior : GanttDragDropBehavior
    {
        protected override DropRelativePosition GetReorderDropPosition(double overlappingValue)
        {
            return DropRelativePosition.Before;
        }
    }

    <telerik:RadGanttView x:Name="gantt" TasksSource="{Binding GanttTasks}" VisibleRange="{Binding VisibleRange}" >
        <telerik:RadGanttView.DragDropBehavior>
            <local:CustomDragDropBehavior  />
        </telerik:RadGanttView.DragDropBehavior>
        <telerik:RadGanttView.Columns>
            <!-- ... -->
        </telerik:RadGanttView.Columns>
    </telerik:RadGanttView>

    Hope this helps.

    Regards,
    Polya
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ludwig
    Ludwig avatar
    10 posts
    Member since:
    Oct 2014

    Posted 07 Nov Link to this post

    Hello Polya and thank you very much - works like charme.
Back to Top