I am moving from ArcGIS WPF to ArcGIS .NET.
When I add shapefiles to the map layer in the .NET version the backdrop ArcGISTiledMapServiceLayer disappears.
Can anybody tell me how to correct it?
I use Visual Studio 2013, VB.NET and Esri.ArcGISRuntime 10.2.6.0.
Here is the code:
Title="MainWindow" Height="600" Width="800"
<!-- A MapView Control to display various GIS layers. -->
<esri:MapView x:Name="MapView1" Width="662" Height="507" VerticalAlignment="Top" Margin="2,2,2,2">
<!-- A Map. -->
<esri:Map x:Name="Map1" >
<!-- Add a backdrop ArcGISTiledMapServiceLayer-->
' NOTE: The Shapefile that was used in this sample was obtained from the US Census at the following Url:
' http://www.census.gov/geo/maps-data/data/tiger-data.html <-- expand the '2010 Census' | 'Demographic Profile1 - Shapefile Format' section and click on the 'States' link
' The downloaded file (State_2010Census_DP1.zip) was then unzipped to reveal the 'C:\TestData\State_2010Census_DP1' directory structure that contains
' the Shapefile (.shp, .dbf, .shx, and .prj) and a metadata file (DP_TableDescriptions.xls) that describes the attributes fields in the Shapefile.
Public Sub New()
' This call is required by the designer.
' Set the initial extent to that of the continental US.
Dim myEnvelope As Esri.ArcGISRuntime.Geometry.Envelope = New Esri.ArcGISRuntime.Geometry.Envelope(-125.72, 18.73, -66.3, 55.29)
MapView1.Map.InitialViewpoint = New Esri.ArcGISRuntime.Controls.Viewpoint(myEnvelope)
' CAUTION: Local disk based FeatureLayers DO NOT re-project to match the Map's SpatialReference!
' It is recommended to always set the SpatialReference for the Map when using a FeatureLayer based on a local disk based FeatureTable such as
' a ShapefileTable or a GeodatabaseFeatureTable. The reason is that the visual elements of the FeatureLayer may not display if the Shapefile or
' GeodatabaseFeatureTable are not based on the SpatialReference WKID of 3787 (aka. Web Mercator). By specifying the Map's SpatialReference to
' be exactly the same at the ShapefileTable or GeodatabaseFeatureTable, you will be assured that it displays visually in the Map.
' NOTE: If the FeatureLayer is based on an ArcGIS Server web ServiceFeatureTable, then re-projection of the data automatically occurs
' to match the SpatialReference of the Map.
MapView1.Map.SpatialReference = Esri.ArcGISRuntime.Geometry.SpatialReference.Create(4269)
Private Async Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
' Create a ShapefileTable from the .shp file.
Dim myShapefileTable As Esri.ArcGISRuntime.Data.ShapefileTable = Await Esri.ArcGISRuntime.Data.ShapefileTable.OpenAsync("C:\TestData\State_2010Census_DP1\State_2010Census_DP1.shp")
' Create a new FeatureLayer based upon the ShapefileTable. Set its .ID and .DisplayName properties.
Dim myFeatureLayer As Esri.ArcGISRuntime.Layers.FeatureLayer = New Esri.ArcGISRuntime.Layers.FeatureLayer(myShapefileTable)
myFeatureLayer.ID = "States"
myFeatureLayer.DisplayName = "States"
' Add the FeatureLayer to the Map.