Map initial extent

View inMAUIUWPWPFWinUIView on GitHub

Display the map at an initial viewpoint representing a bounding geometry.

Image of map initial extent

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

  1. Instantiate a Map object.
  2. Instantiate a Viewpoint object using an Envelope object.
  3. Set the starting location of the map with map.InitialViewpoint.
  4. Set the map in the MapView.

Relevant API

  • Envelope
  • Map
  • MapView
  • Point
  • Viewpoint

Tags

extent, envelope, initial, viewpoint, zoom

Sample Code

SetInitialMapArea.xamlSetInitialMapArea.xamlSetInitialMapArea.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
<UserControl
    x:Class="ArcGIS.UWP.Samples.SetInitialMapArea.SetInitialMapArea"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <esriUI:MapView x:Name="MyMapView"/>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.