How to add an online tiled layer

The following steps assume you have created a Windows Presentation Foundation (WPF) application in Visual Studio 2010 and are working in the Extensible Application Markup Language (XAML) view of the main page of your application.

Add a reference to ESRI.ArcGIS.Client.dll.

In XAML, add an Extensible Markup Language (XML) namespace that references the ArcGIS schema for WPF.

xmlns:esri="http://schemas.esri.com/arcgis/client/2009">

Add the Map control element to a container element in the page. In this example, the container is a Grid. Use the ESRI.ArcGIS.Client namespace identifier, esri, to define the namespace that contains the Map control. Give the Map control a unique name using the x:Name attribute.

<Grid x:Name="LayoutRoot" Background="White">
        <esri:Map x:Name="MyMap" >
        </esri:Map>
    </Grid>

Add an ArcGIS for Server tiled map service layer to the map. The map contains a collection of layers referenced by the Layers property. In XAML, you can modify the contents of the Layers property using property element syntax. Basically, this means you can specify the property name as an child element (for example, Map.Layers) and include the appropriate contents. In this case, the appropriate content is a ArcGISTileMapServiceLayer element, which enables you to reference an ArcGIS for Server cached map service. Define the Url to the map service endpoint and include a unique ID for the layer. Note, specifying the Layers property inside the Map tag is optional.

<Grid x:Name="LayoutRoot" Background="White">
    <esri:Map x:Name="MyMap" >
        <esri:Map.Layers>
            <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
                      Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
        </esri:Map.Layers>
    </esri:Map>
</Grid>

Compile and run your application.

1/27/2015