Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the mouse position during drag and drop

Does anyone know how to get the correct mouse position during a drag-and-drop operation in WPF? I've used Mouse.GetPosition() but the returned value is incorrect.

like image 449
J W Avatar asked May 27 '09 11:05

J W


People also ask

How do you get the mouse pointer position?

Once you're in Mouse settings, select Additional mouse options from the links on the right side of the page. In Mouse Properties, on the Pointer Options tab, at the bottom, select Show location of pointer when I press the CTRL key, and then select OK. To see it in action, press CTRL.

How do I drag and drop with mouse?

For example, to drag-and-drop an object, such as an icon, you first move your mouse cursor over it. Then, press and hold down the left mouse button, move the object to the location you desire, and release the mouse button to set it down.

What is mouse dragging?

Clicking and Dragging. "Clicking and dragging" is a way to move certain objects on the screen. To move an object, place the mouse cursor over it, press and hold down the left mouse button, then move the mouse while still holding down the left mouse button.

What will happen when we drag mouse on text?

If you have released the mouse button after selecting a block of text, you can't adjust the amount of text that's selected by pointing to it and dragging. If you try to do this, you'll end up moving the text instead. You can, however, adjust the selection by using the keyboard (see the next task).


1 Answers

Never mind, I've found a solution. Using DragEventArgs.GetPosition() returns the correct position.

like image 111
J W Avatar answered Sep 22 '22 06:09

J W