Getting started with Expression Blend
Microsoft Expression Blend is a tool which provides an interactive, aesthetic environment to create WPF applications. To get started, install Expression Blend 4, Blend for Visual Studio 2012, or Blend for Visual Studfio 2013, for a true visual design-time experience when building WPF applications.
To enhance the developer experience, project templates have been added to Expression Blend 4, Blend for Visual Studio and Blend for Visual Studio 2013. The ArcGIS Runtime SDK for WPF Integration Framework is an optional installation feature included with the ArcGIS Runtime SDK for WPF download. A project template includes all the files and property settings necessary to begin a specific type of WPF project. You can create new projects for customization by using a project template. The project template is available in the languages Visual C# or Visual Basic.
The ArcGIS Runtime SDK 10.2.5 for WPF Application template demonstrates demonstrates how to add online and local service layers to your application.
Getting started with project templates
- Install the ArcGIS Runtime SDK for WPF IDE Integration Framework included with the ArcGIS Runtime SDK for WPF install
- Open Expression Blend
- Click File > New > Project. The New Project dialog box appears with the list of Installed templates.
- Navigate to ArcGIS > WPF and you should see the ArcGIS Runtime SDK 10.2.5 for WPF Application template installed as shown below:
- Switch to the prefered language of Visual Basic or Visual C#
- Click ok
- The template consists of XAML markup code, a designer and Visual C# or Visual Basic code behind. In general, you can create the majority of your application user interface in XAML markup.
- In the Project References notice that the ESRI.ArcGIS.Client and ESRI.ArcGIS.Client.Local libraries are present.
- Examine the MainWindow.xaml code in the created project and notice that
- a Map has been created and added as the content to the Window
- there are a number of local and online service layers commented out.
- Uncomment the ArcGIS Online Tiled Basemap Layer which has a URL property set to the world topographic map which is made available for users online.
- Build and Run the application. The map application should appear as follows:
Working with local data
- To customize the template edit the XAML markup or/and the code behind. To work quickly with local data uncomment the XAML markup to add the service layers required. Local Tiled Basemap layers are useful as visual base layers on which to place operational data. To use the Local Tiled Basemap Layer provided with the SDK samples enter the relative or absolute path to the data as shown below:
<!-- Local Tiled Basemap Layer -->
<esri:ArcGISLocalTiledLayer ID="arcGISLocalTiledLayer" Path="C:\Program Files (x86)\ArcGIS SDKs\WPF10.2.5\sdk\samples\data\tpks
\Topographic.tpk"/>
- Operational data can be added to the map using Local Dynamic Layers. To add a Local Dynamic Layer uncomment the XAML mark-up and specify the path and layer name as shown below:
<!--Local Dynamic Layer-->
<esri:ArcGISLocalDynamicMapServiceLayer ID="arcGISLocalDynamicMapServiceLayer"
Path="C:\Program Files (x86)\ArcGIS SDKs\WPF10.2.5\sdk\samples\data\mpks\USCitiesStates.mpk"/>
- Local Feature Layers are a special type of Graphics layer that allow you to display graphic features which consist of geometry and attributes. To add a Local Feature Layer uncomment the XAML mark-up and specify the path and layer name as shown below:
<!--Local Feature Layer-->
<esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer"
Path= "C:\Program Files (x86)\ArcGIS SDKs\WPF10.2.5\sdk\samples\data\mpks\USCitiesStates.mpk" LayerName="Cities"/>
- Navigate to the Visual C# or Visual Basic code behind and note that local service layers have been commented out. Uncomment the code where a LocalMapService is started and used to create an ArcGISLocalDynamicMapServiceLayer which is added to the Map control. Specify the path to a Local Map Package and the layer ID of the ArcGISLocalDynamicMapServiceLayer as shown below:
LocalMapService.GetServiceAsync(@"C:\Program Files (x86)\ArcGIS SDKs\WPF10.2.5\sdk\samples\data\mpks\USCitiesStates.mpk",
(localMapService) =>
{
ArcGISLocalDynamicMapServiceLayer arcGISLocalDynamicMapServiceLayer = new ArcGISLocalDynamicMapServiceLayer()
{
Service = localMapService,
ID = "Cities",
};
_mapControl.Layers.Add(arcGISLocalDynamicMapServiceLayer);
});
License the application for deployment
- The project template provides code to demonstrate how to license the application for deployment purposes. Navigate to the Visual C# or Visual Basic App.xaml code behind and examine the license code commented out, uncomment this code and enter the deployment license string.