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.
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.
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.
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.
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).
Never mind, I've found a solution. Using DragEventArgs.GetPosition()
returns the correct position.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With