I'd like to select a feature, and then click & hold the mouse button to drag it to a new location, setting the new location when the mouse button is released. However, the mouse move events don't seem to be firing when the left mouse button is held down. I suspect this is related to the map panning operation, which is also done with mouse-down-drag-release sequence. But, it's the same with the right mouse button held down.
I tried turning off panning with this code, but no luck. Still no mouse move events.
MainMapView.InteractionOptions = new MapViewInteractionOptions(); MainMapView.InteractionOptions.IsPanEnabled = false;
I also tried right mouse button down with sketch editor active and again no mouse events.
Is there any way for me to get mouse move events with either of the buttons held down?
I wanted to do this a while ago. I instead settled with clicking the graphic which then "picked it up" and then I could move my mouse round and then click again when I wanted to place it. It wasn't quite drag and drop, but it was very close.
Yeah, it's not ideal. My process goes:
> Turn on graphic editing
> Click marker (highlights it blue)
> Press "Move Marker" button
> Marker now moves with the mouse
> Click map to place in new spot
> Press save
Ugly, but works.
I created a similar application where I needed to drag the graphic.
Used mouse events: Mouse down(identify and ready for moving it), Mouse move (check if the mouse is still down while moving, which is drag) , and Mouse up(Confirmation popup). There might be better ways but this worked for me.
Along with disabling the map pan, in mouse down event, you can use Mouse.Capture(null) which releases the mouse down event and mouse move event can be captured.
Hope this gives some ideas!