Getting Started

Creating an application using the ArcGIS API for Silverlight

To begin working with the ArcGIS API for Silverlight/WPF, follow these steps:

  1. Download and install the ArcGIS API for Microsoft Silverlight/WPF setup.

  2. In Visual Studio 2008 create a Silverlight application project with host Web application. Note, if you are creating a new Silverlight application, choose to "Add a new ASP.NET Web project to the solution to host Silverlight."

    To get started in Expression Blend 3, see the Getting Started page in the Working in Expression Blend section in this help system.

  3. Add a reference to one or more of the ArcGIS Silverlight API assemblies in your Silverlight application project.

    • In Visual Studio 2008, open Solution Explorer and locate the Silverlight application project.
    • Right click on the References node and select "Add Reference...".
    • Under the .NET tab, select and add the ESRI.ArcGIS.Client assembly.

  4. In your Silverlight application, open a Silverlight User Control in XAML view (e.g. Page.xaml) and add code to access and display an ArcGIS Server map service.

    For example, the following code shows the items necessary to add and display a map and an ArcGIS Server cached map service.
    • Add a namespace reference to the ESRI.ArcGIS.Client namespace in the ESRI.ArcGIS.Client assembly.
    • Add a Map control.
    • Add a ArcGISTiledMapServerLayer in the Map element.
    • On the ArcGISTiledMapServerLayer element, define the Url to the REST endpoint for the ArcGIS Server cached map service.

    <UserControl x:Class="SilverlightApp.Page"
    <Grid x:Name="LayoutRoot">

    <esri:Map x:Name="MyMap" >
    <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
    Url=""/> </esri:Map>


  5. Compile the code and run your application. Your Silverlight application should be hosted in an html or aspx page on a Web server and accessed in a browser. The Visual Studio's internal Web Development Server will work. If the map is blank, check the following:

    1. Accessing an html page via the file system will not allow remote map services to display within the Map control. By default, files accessed via the file system in a browser have restricted access to remote services which includes ArcGIS Online services.

    2. In order to access an ArcGIS Server site on a different domain than the Silverlight application host site, the ArcGIS Server site must enable remote access to services. This is accomplished using a clientaccesspolicy.xml or crossdomain.xml. In most cases, just place the xml file at the root of your Web site (e.g. for IIS, c:\inetpub\wwwroot\). Note, ArcGIS Online already hosts both files to support cross domain access for all Silverlight clients. See the FAQ topic in this help system for more details.

For more information

See the section about Maps and Layers for more information about the components presented in this quick tutorial.

To explore ArcGIS Silverlight components in action, see the SDK samples.

For tips on discovering ArcGIS Server map services, see Understanding ArcGIS Server.