private async void OnViewpointMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
{
// Get title from the selected item
var selectedMapTitle = e.Item.TitleCondensedFormatted.ToString();
switch (selectedMapTitle)
{
case "Geometry":
// Set Viewpoint using Redlands envelope defined above and a padding of 20
await _myMapView.SetViewpointGeometryAsync(RedlandsEnvelope, 20);
break;
case "Center & Scale":
// Set Viewpoint so that it is centered on the London coordinates defined above
await _myMapView.SetViewpointCenterAsync(LondonCoords);
// Set the Viewpoint scale to match the specified scale
await _myMapView.SetViewpointScaleAsync(LondonScale);
break;
case "Animate":
// Navigate to full extent of the first baselayer before animating to specified geometry
await _myMapView.SetViewpointAsync(
new Viewpoint(_myMapView.Map.Basemap.BaseLayers.First().FullExtent));
// Create a new Viewpoint using the specified geometry
var viewpoint = new Viewpoint(EdinburghEnvelope);
// Set Viewpoint of MapView to the Viewpoint created above and animate to it using a timespan of 5 seconds
await _myMapView.SetViewpointAsync(viewpoint, TimeSpan.FromSeconds(5));
break;
default:
break;
}
}