Hi, we are currently developing an export feature where some elements are static (but can be dragged around and resized, e.g. legend, title etc) and some elements are draggable as if on a map.
Currently the solution I came up with is to hook into
MapView_PreviewMouseLeftButtonDown
save the map layer coordinates, and set
MapView.CaptureMouse();
e.Handled = true;
Then, on MapView_PreviewMouseMove, I calculate the delta it moved on the x and y position, normalize the values and then set
Model.PanMap(panXPercent, panYPercent, triggerLayoutChange: false);
_lastMousePosition = currentPosition;
_cachedMapLayer.MapExtent = Model.MapExtent;
MapView.CancellationTokenSource?.Cancel();
_ = MapView.RefreshAsync();
And then on MapView_PreviewMouseLeftButtonUp
I set
MapView.ReleaseMouseCapture();
MapView.CancellationTokenSource?.Cancel();
This works and only moves the layers without moving static elements
However, it is quite expensive and also rather laggy when adding more complex layers or increasing the window size. Is there a better way of having static elements on a pannable map?


