Platform = Xamarin Forms, Language = C#
I wish to open a MapView to contain two points plus some padding for the convenience of the user.
Currently I do something like
Geometry geometry = new PolyLine() { mapPoint1, mapPoint2 };
MapView map = .....;
map.InitalViewPoint = new Viewpoint(geometry);
This opens the mapview to right place but puts my two points right on the edge. I would like some padding like I can get with
await map.SetViewpointGeometryAsync(geometry, 30);
The problem with using SetViewpointGeometryAsync is the map will display at the choosen InitialViewPoint then move to the new ViewPoint. If I don't set the InitialViewPoint it just uses the default initial location from the map I am using.
This is a jarring experience for the user where they see one map then it moves to another location which is what they are really interested in.
Is there anyway I can get rid of this two step scroll and also get padding at the time time.
Solved! Go to Solution.
Have you tried setting the ViewInsets on the view?
MyMapView.ViewInsets = new Thickness(50);
This sets up a more "permanent" padding for all zoom operations (it's usually used for when you for instance have a side panel open, and you want to add some padding on just one side where the panel is, so the center of the map is pushed a little over and any zooms would take that left padding into account).
You can always reset the insets after the mapview has loaded back to zero.
https://developers.arcgis.com/net/api-reference/api/netwin/wpf/Esri.ArcGISRuntime.UI.Controls.GeoVie...
Have you tried setting the ViewInsets on the view?
MyMapView.ViewInsets = new Thickness(50);
This sets up a more "permanent" padding for all zoom operations (it's usually used for when you for instance have a side panel open, and you want to add some padding on just one side where the panel is, so the center of the map is pushed a little over and any zooms would take that left padding into account).
You can always reset the insets after the mapview has loaded back to zero.
https://developers.arcgis.com/net/api-reference/api/netwin/wpf/Esri.ArcGISRuntime.UI.Controls.GeoVie...
Worked a treat, thanks very much