Skip To Content ArcGIS for Developers Sign In Dashboard


You will learn: how to build an app that displays feature layers in a 2D map.

With ArcGIS Runtime SDK for .NET, it's easy to create a mapping app that displays a basemap and one or more layers. ArcGIS Online hosts several basemaps (in both image and vector tile format) that you can use in your map (2D) or scene (3D). Feature layers allow you to add datasets hosted online (with ArcGIS Online or other ArcGIS servers) or stored locally (in a runtime geodatabase, for example). The data returned and the symbology used can be customized for a feature layer.

In this tutorial you will create a new map with an imagery basemap, add a feature layer to it, and display the map in your app.


Create a new ArcGIS Runtime App Visual Studio Project

  1. Start Visual Studio.

  2. Choose File > New > Project and select the ArcGIS Runtime app (WPF .NET Framework) template for your chosen platform.

Create a new map with an imagery basemap

  1. Open the MapViewModel.cs code file in your project. Find the definition for the Map property in the class. Notice that the default map is currently set to display the streets vector tile basemap.

  2. Add the following function to the MapViewModel class:

    private async void CreateNewMap()
  3. Add code to create a new Map with an imagery basemap. In the following steps, add your code inside the CreateNewMap() function you created above.

    Map newMap = new Map(Basemap.CreateImageryWithLabels());

Create a new map layer

  1. Add code that creates a new FeatureLayer. For the layer data source, provide a URI to the Trailheads layer in the Los Angeles Trails map service.

    FeatureLayer trailHeadsLayer = new FeatureLayer(new Uri(""));
  2. Load the layer asynchronously and await its completion.

    await trailHeadsLayer.LoadAsync();
  3. Add the layer to the map's collection of operational layers.

  4. Set the initial display area (Viewpoint) of the map to the extent of features in the trailheads layer.

    newMap.InitialViewpoint = new Viewpoint(trailHeadsLayer.FullExtent);

Display the new map in your app

  1. Set the MapViewModel.Map property with your new map.

    Map = newMap;
  2. Call your CreateNewMap function from the MapViewModel constructor.

    public MapViewModel()
  3. Run your app to test your code. When the app opens, you should see an imagery map of Los Angeles appear with trailhead points displayed on top.

Congratulations, you're done!

Check out and compare with our completed solution project.


Explore basemaps

Look at the available static methods on the Basemap class for creating basemaps for your Map. Modify your code to display a different basemap. For example:

Map newMap = new Map(Basemap.CreateNationalGeographic());

Add additional feature layers

Visit ArcGIS Online and find additional interesting park datasets to load into the app. Here are a couple suggestions:

  • Trails (lines):
  • Parks (polygons):

Filter features in the trailheads layer

Sometimes you want your layer to show a subset of the data from a service. A definition expression lets you define attribute criteria that restrict the features for a layer. Consult the service info for the Trailheads data source and construct an expression for the layer's DefinitionExpression property that will show only trailheads without parking.