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

Start drag on control when mouse leaves control

1 Answer 41 Views
DragAndDrop
This is a migrated thread and some comments may be shown as answers.
Eli Schleifer
Top achievements
Rank 1
Eli Schleifer asked on 13 Oct 2009, 04:58 PM
We have a scenario where we would like to delay dragging while the user is clicking and moving mouse inside a control, but if the mouse is still down when the mouse leaves the control, to fire the drag event then. We have a basic workaround where we will check the mouse poisition and as the mouse approaches the edge of the control we will start the drag, but this is not 100% effective as fast mouse movements will not trigger additional dragqueries.

Is there any way to solve this issue?

1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 16 Oct 2009, 01:59 PM
Hello Eli,

I am sorry for the delayed reply, we were busy with the Beta 2 release of the controls which should be available for download now.

Unfortunately I cannot offer a workaround with the SP1 version of the controls (2009.2 812)

In the internal builds (and in the beta) the DragAndDropManager has the StartDrag() method and here is how you can use it:

1. Register for the MouseLeftButtonDown and Up events on the root visual (root page of your application). Use the rootPage.AddHandler(event, handler, true); method to register for the event. This way you will be notified for the event even if is handled. This way you will know if the mouse is pressed or not.

2. Register for the MouseLeave event on the particular control

3. In the MouseLeave handler check if the mouse is pressed and start dragging using the StartDrag method on the DragAndDrop manager.

There really is no guarantee whether the mouse move event (and therefore the drag/drop events) will be called if the user moves the mouse quickly, so I cannot think of another workaround.

Regards,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
DragAndDrop
Asked by
Eli Schleifer
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or