Detect drag/drop cancel

2 posts, 1 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 30 Jan 2014 Link to this post

    Hi!

    I'm using the following code to manage drag and drop from a listbox to the ScheduleView:

    RadDragAndDropManager.AddDragQueryHandler(MyList, new EventHandler<DragDropQueryEventArgs>(this.OnDragQuery));
    RadDragAndDropManager.AddDropQueryHandler(MyList, new EventHandler<DragDropQueryEventArgs>(this.OnDropQuery));

    In the OnDragQuery() method I change the snapping behavior of the ScheduleView because I want different behavior when dragging appointments within the ScheduleView and when dragging items from the ListBox into the ScheduleView.
    In the OnDropQuery() method I reset the behavior back to default again.

    The problem occurs if the user cancels the drag by for example pressing the Escape-key.
    I don't know how to catch that event so that I can reset the behavior there also.

    I have noticed that the DragStatus enum used in DragDropQueryEventArgs contains several statuses that I would like to handle.
    But I don't understand how to reach them. The OnDragQuery() method only fires upon drag and the RadDragAndDropManager does not have a suitable method like for example AddDragCancelHandler.

    Regards,
    Håkan




  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 03 Feb 2014 Link to this post

    Hi Håkan,

    First, I would like to note that RadDragAndDropManager is obsolete and should be replaced with DragDropManager. As to the drag and drop between RadScheduleView and RadListBox - I'd suggest that you check the following example in our XAML SDK Repository:
    https://github.com/telerik/xaml-sdk/tree/master/ListBox/DragDropWithScheduleView
    which demonstrates how the drag-drop can be implemented using the built-in ListBoxDragDropBehavior and customizing the ScheduleViewDragDropBehavior.
    The additional functionality that you're describing should be added inside the ScheduleViewDragDropBehavior methods, please check here for more details.

    Please try it and if you have any issues/questions, write to us again.

    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top