I would like to be able to register to a Preview Dragging event on the map.
DETAILS
I am showing polygon on the map, with added pins as its corners.
I am trying to validate the shape of the polygon according to business logic,
but currently my validation happens after the user has dragged the pin somewhere on the map.
Meaning I have no way to intervene in the dragging process and keep the pin at a certain place,
since my validation happens after the pin has already moved to where the user dragged it.
Currently my validation is done by registering to PinDragging event, where the pin is already shown in the new position, then the validation happens, then trying to get the pin to previous valid position,
which causes the pin to jump from invalid position to last valid position as user drags it.
map.PreviewPinDragging+=(sender, eventArgs)=>
{
var updatedPolygon = GetUpdatePolygon(_currentDraggedPinIndex, eventArgs.Position);
bool isValid = MyValidator.Validate(updatedPolygon);
if(isValid == false)
{
eventArgs.Handled=True; // To prevent event from escelating into PinDragged event, and keep pin in current position.
_currentDraggedPin.Position = _lastValidPosition;
}
}
SUMMARY
I would like to be able to register to a Preview Dragging event on the map.
DETAILS
I am showing polygon on the map, with added pins as its corners. I am trying to validate the shape of the polygon according to business logic, but currently my validation happens after the user has dragged the pin somewhere on the map. Meaning I have no way to intervene in the dragging process and keep the pin at a certain place, since my validation happens after the pin has already moved to where the user dragged it. Currently my validation is done by registering to PinDragging event, where the pin is already shown in the new position, then the validation happens, then trying to get the pin to previous valid position, which causes the pin to jump from invalid position to last valid position as user drags it.
PLATFORMS