Set Initial Map Extent

Download Samples Repository

Description

Shows how to set the initial extent of the map (Map.InitialViewpoint).

"Desktop" "Store" "Phone" Available for Desktop, Store, Phone

Sample Code

<UserControl x:Class="ArcGISRuntime.Samples.Desktop.SetInitialMapExtent"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView">
			<esri:Map InitialViewpoint="-117.182686,32.695853,-117.133872,32.718530,4326">
				<!-- Or -->
				<!--<esri:Map.InitialViewpoint>
					<esri:ViewpointExtent XMin="-117.182686" YMin="32.695853" XMax="-117.133872" YMax="32.718530" SpatialReferenceID="4326" />
				</esri:Map.InitialViewpoint>-->
				<esri:ArcGISTiledMapServiceLayer 
                    ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
            </esri:Map>
        </esri:MapView>
    </Grid>
</UserControl>
using System.Windows.Controls;

namespace ArcGISRuntime.Samples.Desktop
{
    /// <summary>
	/// Shows how to set the initial extent of the map (Map.InitialViewpoint).
    /// </summary>
	/// <title>Set Initial Map Extent</title>
	/// <category>Mapping</category>
	public partial class SetInitialMapExtent : UserControl
    {
        public SetInitialMapExtent()
        {
            InitializeComponent();

			// Note: uncomment the following to set the initial extent of the map in code.
			//MyMapView.Map.InitialViewpoint = new Envelope(-117.182686,32.695853,-117.133872,32.718530, SpatialReferences.Wgs84);
        }
    }
}
Feedback on this topic?