DragOver not fired

4 posts, 0 answers
  1. Gunther
    Gunther avatar
    3 posts
    Member since:
    Jan 2013

    Posted 06 Feb 2014 Link to this post

    I have a view where I drag from a GridView to a ScheduleView. In the constructor of the View (xaml code behind) I initialize the following events.

    DragDropManager.AddDragInitializeHandler(Grid, OnDragInitialize);
    DragDropManager.AddGiveFeedbackHandler(Grid, OnGiveFeedback);
    DragDropManager.AddDragDropCompletedHandler(Grid, OnDragDropComplete);
    DragDropManager.AddDragOverHandler(ScheduleView, OnDragOver);
    DragDropManager.AddDragEnterHandler(ScheduleView, OnDragEnter);

    All events are fired except for the OnDragOver...
    If I subscribe the Dragover to the source Grid I get the event but only when dragging over the Grid (as expected I assume) not when entering the ScheduleView.
    How can I enable the DragOver events?
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 11 Feb 2014 Link to this post

    Hello Gunther,

    This is so because the DragOver event is handled inside of the ScheduleView. In order to execute your method even the event is handled internally you will need to use the other overload of the same method:

    DragDropManager.AddDragOverHandler(ScheduleView, OnDragOver, true);

    True indicates that the handler will be invoked even if the event has been handled. However I would like to suggest you not to handle the event inside of your handler, as this may cause the ScheduleView to misbehave.

    Hope this helps.

    Regards,
    Kalin
    Telerik

    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

  3. UI for WPF is Visual Studio 2017 Ready
  4. Gunther
    Gunther avatar
    3 posts
    Member since:
    Jan 2013

    Posted 11 Feb 2014 in reply to Kalin Link to this post

    This worked. But maybe there is a better solution to my problem.
    I want to drag items on top of a existing appointment and change the appointment accordingly. I've searched the forum but did not find any simple solution. (I did find a few posts with the same question)

    Now I've used the DragOverEvent to capture the mouse coordinates and used the mouse coordinates and the appointment coordinates to find the correct appointment with I change in the Drop of my custom DragDropBehavior.
     
  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 14 Feb 2014 Link to this post

    Hello Gunther,

    We have such a sample project which demonstrates how to drag items from ListBox and only drop them on Appointments. And when the item is dropped it modifies a property of the Appointment. In the implementation we have used attached drag drop behavior for each Appointment which handles the DragEnter, DragLeave and Drop events, but you could also handle the DragOver event and implement the desired logic there. For more details check the attached project.

    Hope this will work for you.

    Regards,
    Kalin
    Telerik

    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Back to Top