Display the map at an initial viewpoint representing a bounding geometry.
Use case
Setting the initial viewpoint is useful when a user wishes to first load the map at a particular area of interest.
How to use the sample
When the sample loads, note that the map view opens at the initial viewpoint defined on the map.
How it works
- Instantiate a
Map
object. - Instantiate a
Viewpoint
object using anEnvelope
object. - Set the starting location of the map with
map.InitialViewpoint
. - Set the map in the
MapView
.
Relevant API
- Envelope
- Map
- MapView
- Point
- Viewpoint
Tags
envelope, extent, initial, viewpoint, zoom
Sample Code
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntime.Samples.SetInitialMapArea.SetInitialMapArea"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
</Grid>
</ContentPage>