Click or drag to resize
Code Examples

This book provides access to samples that teach how to use the various parts of ArcGIS Runtime .NET SDK (Windows Desktop). Each sample has a description, a basic screen shot of what the sample looks like, and views of key code files for quick reference.

Samples available

AllLayersServiceInfo_FeatureServiceLayerInfo - Demonstrates getting detailed ArcGIS Server MapServer metadata for various ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer web services.

ArcGISDynamicMapServiceLayer - Shows creating an ArcGISDynamicMapServiceLayer in XAML and defining the serviceUri property for the layer.

ArcGISDynamicMapServiceLayer_GetDetails - Shows adding an ArcGISDynamicMapServiceLayer with a LayerDefinition applied (discovered by the ArcGISDynamicMapServiceLayer.GetDetailsAsync Method) and then modifying the LayerDefinition to change the features returned.

ArcGISDynamicMapServiceLayer_VisibleLayers - Shows obtaining which sub-layers are visible using the ArcGISDynamicMapServiceLayer.GetAllDetailsAsync Method. Then the user can interact with application and change the VisibleLayers of the ArcGISDynamicMapServiceLayer.

ArcGISDynamicMapServiceLayerImageFormat - Shows changing the return ImageFormat for ArcGISDynamicMapServiceLayer and how that appears visually in the Map.

ArcGISDynamicMapServiceLayerXamlAndCodeBehind - Shows creating an ArcGISDynamicMapServiceLayer in XAML and via code-behind. The ArcGISDynamicMapServiceLayer.InitializeAsync Method is used to obtain metadata about the layer (i.e. ID and Copyright) using the Async/Task framework.

ArcGISImageServiceLayerWindow - Shows creating an ArcGIS Image Service Layer and applying rendering rules.

ArcGISImageServiceLayerXamlAndCodeBehind - Shows adding an ArcGISImageServiceLayer via XAML and code-behind. The ArcGISImageServiceLayer.InitializeAsync Method is used to obtain metadata about the layer (i.e. ID and Description) using the Async/Task framework.

AreaUnits - Allows the user to convert from Square Meters to various AreaUnits values (i.e. Acres, Square Miles, etc.) and the opposite.

BaseMaps - Demonstrates switching out various BaseMap (via ArcGISTiledMapServiceLayer) layers served up by ArcGIS Online.

BingLayer_Advanced - Teaches one method (advanced) for using the Microsoft WebClient and a DataContract to poll a Microsoft Bing development server to determine if a Bing Key is correct and then loading multiple BingLayer's into the Map and allowing the user to switch between various BingLayer.MapStyles.

Camera_FollowPolyline_ViaSetViewAsync - Demonstrates drawing a Polyline in a SceneView and then navigating/animating along that Polyline with a Camera.

Camera_Properties - Shows adjusting the Camera Properties of a SceneView to view different perspectives of data on the Earth.

Camera_SetMethods - Demonstrates navigating/animating between MapPoint Graphics with a Camera. Simultaneous changes of X, Y, Z, Pitch, and Heading during the animation is shown.

CreateDynamicLayerInfosFromLayerInfos - Demonstrates applying a custom rendering via XAML using the Dynamic Layer option of an ArcGISDynamicMapServiceLayer. Also, shows how to use the ArcGISDynamicMapServiceLayer.CreateDynamicLayerInfosFromLayerInfos Method to obtain the original rendering of the layer that was defined in the map service. The CreateDynamicLayerInfosFromLayerInfos is then used to reset the layer back to original rendering.

CSVLayerXaml - Demonstrates defining a CsvLayer in XAML and setting the serviceUri property to a text file hosted online by the United States Geological Survey (USGS).

DynamicLayerInfoCollection - Demonstrates using various Renderers on a Dynamic Layer when the 'WorkspaceID' and 'DataSourceName' are known using a TableDataSource.

DynamicLayerInfos - Demonstrates using various Renderers on a Dynamic Layer (via XAML and code-behind) when the 'WorkspaceID' and 'DataSourceName' are known using a TableDataSource.

Editor_Sketching - Demonstrates sketching various geometric shapes on the map via the Editor.RequestShapeAsync method. The sketches are then added as Graphics in a GraphicsLayer and drawn on the map.

EditorConfiguration - Demonstrates sketching Polyline shapes on the map via the Editor.RequestShapeAsync method. The sketches are then added as Graphics in a GraphicsLayer and drawn on the map. Multiple versions of customizing the symbology of the Editor are shown.

EqualGeometries - Demonstrates the differences in comparing a few polygon geometries to via the Geometry.IsEqual and GeometryEngine.Equals Methods.

FeatureLayer_Identify - Demonstrates labeling highway names in a FeatureLayer.

FeatureLayer_Labeling - Demonstrates performing and Identify on a FeatureLayer. The FeatureLayer.HitTestAsync method is used to select (and highlight) the feature a user clicks/taps on as well as display specific attributes for that feature.

FeatureLayer_SelectFeaturesByRectangle - Demonstrates selecting features in a FeatureLayer by dragging a rectangle across the map. Features are then highlighted in the FeatureLayer and their selected ID values are displayed in a Listbox.

FeatureLayer_SetFeatureVisible - Demonstrates being able to turn on/off the visibility of a feature in a FeatureLayer by tapping on it.

FeatureLayerViaGeodatabase - Demonstrates creating a FeatureLayer from a GeodatabaseFeatureTable in an ArcGIS Runtime provisioned Geodatabase that is stored locally on disk.

FeatureLayerViaGeodatabaseWebDownload - Demonstrates downloading a Geodatabase on ArcGIS Server to the local disk and then creating a FeatureLayer from a GeodatabaseFeatureTable in the downloaded Geodatabase.

FeatureLayerViaShapefile - Demonstrates creating a FeatureLayer from a ShapefileTable that is stored locally on disk.

FeatureLayerXamlAndCodeBehind - Shows creating a FeatureLayer in XAML and via code-behind. The FeatureLayer.InitializeAsync Method is used to obtain metadata about the layer (i.e. ID and Copyright) using the Async/Task framework.

FeatureServiceLayerInfo_CopyrightText - Demonstrates using the GetDetailsAsync Method to obtain the FeatureServiceLayerInfo.CopyrightText on an ArcGISDynamicMapServiceLayer.

FindTask - Demonstrates using the Query.FindTask operation to search for text in attribute fields of an ArcGIS Server map service and display the features found as graphics in a GraphicsLayer.

GeocodeFullAddressInput - Demonstrates performing a geocode by submitting values for multiple address fields.

GeocodeSingleLineInput - Performs a single line geocode using either an online ArcGIS Locator service or a local Locator.

GeometryEngine_Buffer - Demonstrates using the powerful GeometryEngine local process to generate graphic buffer polygons based upon a user specified radius and mouse-clicks/taps on the map.

GeometryEngine_BufferWithUnion - Demonstrates using the powerful GeometryEngine local process to generate a single graphic buffer (unioned) based upon multiple points provided by user interaction with the map.

GeometryEngine_ConvexHull - Demonstrates using the powerful GeometryEngine local process to generate a convex hull graphic polygon based upon user specified mouse-clicks/taps on the map.

GeometryEngine_Difference_Intersection_Union - Demonstrates using the powerful GeometryEngine local process to perform the spatial analysis operations of Difference, Intersection, and Union on two input geometries.

GeometryEngine_TestingSpatialRelationships - Demonstrates using the powerful GeometryEngine local process to test various spatial relationships (Contains, Crosses, Disjoint, Equals, Intersects, Overlaps, Touches, Within) between two input geometries.

Geoprocessor_GetTaskInfoAsync - Demonstrates getting the GPTaskInfo metadata for a Geoprocessing task (aka. a GPServer Task on ArcGIS Server).

GeoRSSLayerWindow - Creates a GeoRssLayer based on the United States Geological Survey earthquake feed and assigned a SimpleRenderer.

GetArea - Allows the user to draw a polygon on the map and calculate the area via several methods.

GraphicsLayerWindow - Demonstrates various Graphics and GraphicsLayer related actions.

GraphicsOverlay - Demonstrates using the Query.FindTask operation to return county features in an ArcGIS Server map service and display the features found as Graphics in a GraphicsOverlay. The user can perform a MapViewTapped on the Graphics to perform a GraphicsOverlay.HitTestAsync to select features and display attribute information.

GraphicsLayer_Labeling - Demonstrates labeling city names where the two AttributeLabelClass'es are used (one for smaller cities and one for larger ones).

GraphicsLayer_RenderingMode - Demonstrates setting the various GraphicsLayer.RenderingMode options and their effect on TextSymbols when the MapView is rotated.

IdentifyParameter_DynamicLayerInfos - Demonstrates performing an Identify on a Dynamic Layer using the ESRI.ArcGISRuntime.Tasks.Query.IdentifyParameter.DynamicLayerInfos Property.

IdentifyTask - Demonstrates using the Query.IdentifyTask operation find a feature based upon it's geographic position in an ArcGIS Server map service and display it as a graphic in a GraphicsLayer.

InitialMapExtentCode - Shows how to set the initial extent of the map (Map.InitialExtent) in code.

InitialMapExtentXaml - Shows how to set the initial extent of the map (Map.InitialExtent) in XAML.

LayerCollection - Demonstrates the work-flow of creating a layer dynamically via code-behind. The process of a layer: (1) initializing, (2) determining when initialization is complete, and (3) error trapping for bad initialization is described in detail.

LayerDefinitions - Demonstrates setting numerous LayerDefinitions values on an ArcGISDynamicMapServiceLayer and visualizing the impact of the features being returned in the Map.

LayerDefinitionsSimple - Demonstrates setting the LayerDefinitions Property of an ArcGISDynamicMapServiceLayer where two sub-layers are present. One sub-layer has the LayerDefinition set in XAML and the other sub-layer has it's LayerDefinition set via code-behind.

LayerDrawingOptionCollection - Demonstrates using the existing rendering of a Dynamic Layer sub-layer of an ArcGISDynamicMapServiceLayer and switching to a custom rendering defined in code-behind for the Dynamic Layer.

LayerDrawingOptions - Demonstrates changing the rendering of the first sub-layer of an ArcGISDynamicMapServiceLayer using the Dynamic Layer capabilities of ArcGIS Server 10.1 and higher.

LayersInitialized - Demonstrates implementing logic which is dependent on the layer collection being initialized.

MapServiceInfo_DocumentInfo_LayerServiceInfo - Demonstrates getting detailed ArcGIS Server MapServer metadata to obtain MapServiceInfo data for various ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer web services.

MapView_DragDropEvents - Demonstrates creating a CsvLayer by performing a Drag-and-Drop from a file on the local disk in File Explorer to the MapView.

MapView_LayerLoaded - Demonstrates how to determine if a particular layer has loaded via the MapView.LayerLoaded Event.

MapView_LayersLoadedAsync - Demonstrates how to determine if a particular layer has loaded via the MapView_LayersLoadedAsync Method.

MapView_Overlays - Demonstrates displaying a UIElement on top of the MapView using the MapView.Overlays Property. This is useful for performing MapTip functionality.

MapView_SetView - Demonstrates using the various MapView.SetView Methods to adjust the extent of the map.

MapView_SpatialReference - Demonstrates reseting the MapView.SpatialReference by setting it to a new Map.

MultipleMapsInMapView - Demonstrates switching out different Map objects (with different layers) for the MapView.Map Property.

OpenStreetMapLayerWindow - Demonstrates adding an OpenStreetMap Layer to the Map in XAML.

PictureFillSymbol - Demonstrates the using a SimpleRenderer with options for PictureFillSymbol.

PictureMarkerSymbol - Demonstrates the using a SimpleRenderer with options for SimpleMarkerSymbol, PictureMarkerSymbol, and TextMarkerSymbol.

PolygonBuilder_MakeIslands - Shows how to use the PolygonBuilder to turn multiple independent Polygons into a single Polygon (use case: grouping island Polygons together into one record).

PolygonFromScratch - Demonstrates creating a simple polygon, donut polygon, and multiple ring polygon via code-behind. An option to view coordinate information for each vertex in the polygons is provided.

ProximityResult - Demonstrates identifying the nearest vertex and nearest coordinate in a polyline to a user clicked point in the map via ProximityResult.

QueryTableDataSource - Demonstrates adding a Dynamic Layer via code-behind using a QueryTableDataSource.

RoutingPointToPoint - Demonstrates simple point to point routing between two input locations.

RoutingWithBarriers - Shows routing and re-routing around user defined point, polyline, and polygon barriers.

RoutingWithDirections - Interaction logic for RoutingWithDirections.xaml

SmoothGraphicAnimation - Animates a graphic smoothly between two user defined locations by calling the MapPoint.MoveTo method at regular intervals as defined by a DispatcherTimer. The distance the point is moved each time is calculated by a quintic easing function.

WMTSLayerWindow - Demonstrates adding a WMTS layer to the Map in XAML.