This sample includes a Map and a ArcGISTiledMapServiceLayer and demonstrates how to add an ArcGIS Server cached map service layer to a map. Use ArcGIS Server Services Directory to discover the Url to reference the map service.
Download Sample Application
< UserControl x:Class = " ArcGISWPFSDK.Map "
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 " >
< Grid.Resources >
< BooleanToVisibilityConverter x:Key = " BooleanToVisibilityConverter " />
</ Grid.Resources >
< esri : Map x:Name = " MyMap " WrapAround = " True " Background = " #FFE3E3E3 " >
< esri : ArcGISTiledMapServiceLayer ID = " MyLayer "
Url = " http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer " />
</ esri : Map >
< ProgressBar x:Name = " MyProgressBar " IsIndeterminate = " True " VerticalAlignment = " Bottom " Width = " 200 " Height = " 20 " Margin = " 10 " Visibility = " {Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}} " > </ ProgressBar >
</ Grid >
</ UserControl >
using System.Windows.Controls;
using System.ComponentModel;
namespace ArcGISWPFSDK
{
public partial class Map : UserControl, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private bool _isBusy = true ;
public bool IsBusy
{
get
{
return _isBusy;
}
set
{
_isBusy = value;
if (PropertyChanged != null )
{
PropertyChanged(this , new PropertyChangedEventArgs("IsBusy" ));
}
}
}
public Map()
{
InitializeComponent();
DataContext = this ;
MyMap.Layers.LayersInitialized += (o, evt) =>
{
IsBusy = false ;
};
}
}
}
Imports System.Windows.Controls
Imports System.ComponentModel
Namespace ArcGISWPFSDK
Partial Public Class Map
Inherits UserControl
Implements INotifyPropertyChanged
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Private _isBusy As Boolean = True
Public Property IsBusy() As Boolean
Get
Return _isBusy
End Get
Set (value As Boolean )
_isBusy = value
RaiseEvent PropertyChanged(Me , New PropertyChangedEventArgs("IsBusy" ))
End Set
End Property
Public Sub New ()
InitializeComponent()
AddHandler MyMap.Layers.LayersInitialized, AddressOf map_LayersInitialized
End Sub
Private Sub map_LayersInitialized(sender As Object , e As EventArgs)
DataContext = Me
IsBusy = False
End Sub
End Class
End Namespace
5/16/2014