Getting started
Requirements
To develop applications using the ArcGIS API for Windows Phone you will need to have the Windows Phone Developer Tools on your machine. Download the Windows Phone Developer Tools from http://go.microsoft.com/?LinkID=9713250 and install them on your machine.
The Windows Phone Developer Tools includes Visual Studio 2010 Express for Windows Phone if you do not already have Visual Studio 2010 on your machine. This is the integrated development environment (IDE) that will be used throughout the documentation in this help. However, ArcGIS API for Windows Phone development is also supported with Visual Studio 2010 and with Microsoft Expression Blend 4.
Developers are expected to have a familiarity with Windows Phone development. Documentation on Windows Phone development can be found at Microsoft's Windows Phone developer site, http://developer.windowsphone.com/windows-phone-7.
Downloading the ArcGIS API for Windows Phone SDK
The ArcGIS API for Windows Phone is provided as a ZIP file which is downloaded and its files extracted on the development machine.
- Download the ArcGIS API for Windows Phone ZIP file from the resource center (http://help.arcgis.com/en/arcgismobile/10.0/apis/WindowsPhone).
- Unzip the contents to a directory of your choice. This directory will be referred to as your install location in the rest of this topic.
Note:
Depending on your machine's security settings, you may need to unblock the extracted files before you can use them in an application. To unblock the file, browse to it in Windows Explorer, right-click on it, and open the Properties dialog box. Click on the Unblock button near the bottom of the dialog. If you do not unblock the file, you will get a compile error that reads as follows: "This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project." See http://go.microsoft.com/fwlink/?LinkID=179545 for more information.
- Your install location will contain the assemblies required to develop with the ArcGIS API for Windows Phone. The table below lists the assemblies and provides a description of their contents. These assemblies only provide 32-bit support at this time.
ArcGIS API for Windows Phone assembly
Description
ESRI.ArcGIS.Client.dll
Core library. Contains map, ArcGIS Service layers, graphics, geometry, and symbol components. Also contains common workflow tasks that support query, find, identify, and geospatial and geoprocessing operations.
ESRI.ArcGIS.Client.Bing.dll
Adds support for using Bing layers and services.
ESRI.ArcGIS.Client.Toolkit.dll
Contains a set of common controls for use with the map, such as a Legend and InfoWindow.
ESRI.ArcGIS.Client.Toolkit.DataSources.dll
Contains of a set of layer types that support some common data sources, such as OpenStreetMap and WMS.
Source available on CodePlex: http://esrisilverlight.codeplex.com.
ESRI.ArcGIS.Client.WebMap.dll
Contains components that read and process WebMap contents and metadata. It uses the arcgis.com web map specification version 1.1.
Creating an application using the ArcGIS API for Windows Phone
With the ArcGIS API for Windows Phone SDK setup on your development machine, you are ready to write your first application.
- Open Visual Studio 2010 Express for Windows Phone.
- Create a new project by clicking File and then clicking New Project.
- From the Installed Templates list, select C#, and then select Silverlight for Windows Phone.
- Select the Windows Phone Application template and provide a name for your application.
- Click OK to close the New Project dialog and create your project.
- In the Solution Explorer, right-click on the references for your project and click Add Reference to open the Add Reference dialog.
- Select the Browse tab and browse to your ArcGIS API for Windows Phone installation location. Select the ESRI.ArcGIS.Client.dll included with the ArcGIS API for Windows Phone download and click OK.
- Open MainPage.xaml if it is not already open. Switch to the XAML view if not already visible.
Add a namespace reference to the ESRI.ArcGIS.Client library and namespace by inserting the attribute shown in the following code as an attribute of the phone:PhoneApplicationPage element in the XAML:
xmlns:esri="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
- Add a map and a layer into the content panel of the application by updating the ContentGrid to match the following code:
<Grid x:Name="ContentGrid" Grid.Row="1"> <esri:Map x:Name="MyMap" Extent="-120, 20, -100, 40"> <esri:Map.Layers> <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"> </esri:ArcGISTiledMapServiceLayer> </esri:Map.Layers> </esri:Map> </Grid>
Note:
The esri:Map.Layers element is optional. The layer elements can be directly included in the esri:Map element.
This fills the content area with a map showing the World Street Map.
- Save and run the application. The Windows Phone emulator will show the application.