This is a migrated thread and some comments may be shown as answers.

DragOver not fired

3 Answers 425 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Gunther
Top achievements
Rank 1
Gunther asked on 06 Feb 2014, 09:08 AM
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?

3 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 11 Feb 2014, 08:15 AM
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).

0
Gunther
Top achievements
Rank 1
answered on 11 Feb 2014, 09:32 AM
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.
 
0
Kalin
Telerik team
answered on 14 Feb 2014, 09:12 AM
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).

Tags
DragAndDrop
Asked by
Gunther
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Gunther
Top achievements
Rank 1
Share this question
or