Hi,
I have 2 simple marker overlays, one set to DragMode.Drag and the other DragMode.None. I create a new marker in the draggable overlay and after dragging it, I move it to the non-draggable overlay. My intent is to only have 1 marker draggable at a time. After putting my marker into the non-draggable overlay, the marker is still draggable. Is this a bug? Or is there something I need to do to make the marker realize it’s no longer in a draggable overlay? See attached sample for a demonstration of this behavior.
Thanks,
Trevor
Making a marker un-draggable
Hi Trevor,
Thanks for your reporting. For some reason,
I got 404 error on your attached sample. But I could recreate it with my code.
This issue is caused by the events on the marker is not removed when they are
switching between different overlays. We have fixed it, please try the latest
build (8.0.254.0) and I changed a little.
Marker marker = e.DraggingMarker;
PointShape newLocation =
new
PointShape(marker.Position.X, marker.Position.Y, 0);
//the Z coordinate (elevation) will be looked up in the DEM file later
MessageBox.Show(String.Format(
"Your marker is at {0}, {1}"
, newLocation.X, newLocation.Y));
//once the marker is dropped, move it to the RegularOverlay. It should no longer be able to be dragged.
//remove the marker from the SingleDraggableOverlay
SimpleMarkerOverlay EditableMarkerOverlay = (SimpleMarkerOverlay)Map1.Overlays[
"EditableMarkerOverlay"
];
Marker markerToMove = EditableMarkerOverlay.Markers.Single();
EditableMarkerOverlay.Markers.Remove(markerToMove);
EditableMarkerOverlay.Refresh();
SimpleMarkerOverlay regularOverlay = (SimpleMarkerOverlay)Map1.Overlays[
"RegularOverlay"
];
regularOverlay.Markers.Add(markerToMove);
regularOverlay.Refresh();
Thanks,
Howard
Awesome, thanks for the quick response!
Hi Trevor,
You are welcome, just feel free to let me know if you have more queries.
Thanks,
Howard