RadListBox does not invoke DragDropCompleted Handler

4 posts, 0 answers
  1. David
    David avatar
    7 posts
    Member since:
    Mar 2015

    Posted 25 Mar 2015 Link to this post

    I'm guessing this is yet another bug in the RadListBox event handeling:

    Create a RadListBox and set it up for Drag and Drop, and then attach handlers for DragInitialized and DragDropCompleted.

    Drag and Drop Items and observe:

    1. Dragging item from one list box to another does both DragInitialized and DragDropCompleted (correct)
    2. Dragging an item to an invalid target and dropping does both DragInitialized and DragDropCompleted (correct)
    3. Dragging and item and pressing ESC to cancel also does both DragInitialized and DragDropCompleted (correct)

    However...

    4. Dragging and item to another position in the same listbox to rearrange only calls DragInitialized handler.  The DragDropCompelted handler is never called. (BUG!)

    This screen cast demonstrates: http://screencast.com/t/mx9yQx0EdtZx

    David
  2. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 25 Mar 2015 Link to this post

    Hi David,

    Can you please share some more details on how exactly you have implemented the drag drop functionality? From the provided video looks like that you are using ListBoxDragDropBehavior as well as the DragDropManager. Mixing both of the approaches can cause such an issue as the ListBoxDragDropBehavior uses internally the DragDropManager and handles some of events inside. What I can suggest you would to simply use a custom ListBoxDragDropBehavior and override the needed methods - this way everything should work as expected:

    public class CustomListBoxDragDropBehavior : ListBoxDragDropBehavior
    {
        public override bool CanStartDrag(DragDropState state)
        {
            return base.CanStartDrag(state);
        }
     
        public override void DragDropCompleted(DragDropState state)
        {           
            base.DragDropCompleted(state);
        }
    }

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. David
    David avatar
    7 posts
    Member since:
    Mar 2015

    Posted 25 Mar 2015 in reply to Kalin Link to this post

    Okay, what you suggest will work I guess, but still seems wrong.

    Firstly, the DragDropManager methods for adding a handler have a third paramater that claim to bubble the event to your handeler even if already marked as handled (if you pass true).  For example:

    DragDropManager.AddDragDropCompletedHandler(RightListBox, OnDragComplete, true);

    And curiously, it works... for every situation except rearranging items in a list.  So that is perplexing.



  5. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 27 Mar 2015 Link to this post

    Hi David,

    Thanks for your feedback. I reproduced the explained behavior, however will need some more time in order to further investigate whether this is an issue or expected behavior. Meanwhile you can simply use a custom ListBoxDragDropBehavior in order get notified once those events occur.

    Thanks for understanding.

    Regards,
    Kalin
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top