Drag/Drop doesn't work when TreeListView is in RadLayoutControl

2 posts, 0 answers
  1. Non
    Non avatar
    1 posts
    Member since:
    Jul 2017

    Posted 27 Jul Link to this post

    Hello,

    I've implemented TreeViewDragDropBehavior for TreeListView by using the sample code from Telerik UI for WPF Demo and it's work.

    But when I added the TreeListView into a RadControlLayout, drag/drop events seems stop working. TreeViewDragDropBehavior.OnDragInitialize was fired but nothing happed afterward.

    Any workaround about this?

    Thanks.

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1408 posts

    Posted 31 Jul Link to this post

    Hello Non,

    The reported behavior appears because RadLayoutControl internally works with DragDropManager and it cancels the drag operation in certain cases. In order to prevent this you can handle the DragInitialize event fired by RadTreeListView. This way the drag/drop opeartion won't bubble to the layout control.
    DragDropManager.AddDragInitializeHandler(this.treeListView, OnTreeListViewDragInitialize);

    private void OnTreeListViewDragInitialize(object sender, DragInitializeEventArgs e)
    {
        e.Handled = true;
    }

    I hope this helps.

    Regards,
    Martin Ivanov
    Progress Telerik
    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