This sample demonstrates adding data in a WebMap document housed via ArcGIS Online (http://www.arcgis.com) in a WPF application. The WebMap.GetMapAsync Method call takes a Globally Unique Identifier (GUID) for the WebMap service provided by ArcGIS Online to obtain the geographic data layers. The WebMap's GetMapCompletedEventArgs.Map Property is used to add a Map Class to the WPF application for visual display. The map loaded in this sample references content in a CSV file.
Download Sample Application
< UserControl x:Class = " ArcGISWPFSDK.WebMapWithCSV "
xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation "
xmlns:x = " http://schemas.microsoft.com/winfx/2006/xaml "
xmlns:esri = " http://schemas.esri.com/arcgis/client/2009 " >
< Grid x:Name = " LayoutRoot " Background = " White " >
</ Grid >
</ UserControl >
using System.Windows;
using System.Windows.Controls;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.WebMap;
namespace ArcGISWPFSDK
{
public partial class WebMapWithCSV : UserControl
{
public WebMapWithCSV()
{
// License setting and ArcGIS Runtime initialization is done in Application.xaml.cs.
InitializeComponent();
Document webMap = new Document();
webMap.GetMapCompleted += webMap_GetMapCompleted;
webMap.GetMapAsync("e64c82296b5a48acb0a7f18e3f556607" );
}
void webMap_GetMapCompleted(object sender, GetMapCompletedEventArgs e)
{
if (e.Error == null )
LayoutRoot.Children.Add(e.Map);
}
}
}
Imports System.Windows.Controls
Imports ESRI.ArcGIS.Client.WebMap
Namespace ArcGISWPFSDK
Partial Public Class WebMapWithCSV
Inherits UserControl
Public Sub New ()
InitializeComponent()
Dim webMap As New Document()
AddHandler webMap.GetMapCompleted, AddressOf webMap_GetMapCompleted
webMap.GetMapAsync("e64c82296b5a48acb0a7f18e3f556607" )
End Sub
Private Sub webMap_GetMapCompleted(ByVal sender As Object , ByVal e As GetMapCompletedEventArgs)
If e.Error Is Nothing Then
LayoutRoot.Children.Add(e.Map)
End If
End Sub
End Class
End Namespace
5/16/2014