private void Initialize()
{
// Create new Map
Map myMap = new Map();
// Create the uri for the tiled layer
var tiledLayerUri = new Uri(
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer");
// Create a tiled layer using url
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tiledLayerUri);
tiledLayer.Name = "Tiled Layer";
// Add the tiled layer to map
myMap.OperationalLayers.Add(tiledLayer);
// Create the uri for the ArcGISMapImage layer
var imageLayerUri = new Uri(
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer");
// Create ArcGISMapImage layer using a url
ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(imageLayerUri);
imageLayer.Name = "Image Layer";
// Set the visible scale range for the image layer
imageLayer.MinScale = 40000000;
imageLayer.MaxScale = 2000000;
// Add the image layer to map
myMap.OperationalLayers.Add(imageLayer);
// Create Uri for feature layer
var featureLayerUri = new Uri(
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/Recreation/FeatureServer/0");
// Create a feature layer using url
FeatureLayer myFeatureLayer = new FeatureLayer(featureLayerUri);
myFeatureLayer.Name = "Feature Layer";
// Add the feature layer to map
myMap.OperationalLayers.Add(myFeatureLayer);
// Create a mappoint the map should zoom to
MapPoint mapPoint = new MapPoint(-11000000, 4500000, SpatialReferences.WebMercator);
// Set the initial viewpoint for map
myMap.InitialViewpoint = new Viewpoint(mapPoint, 50000000);
// Initialize the model list with unknown status for each layer
foreach (Layer layer in myMap.OperationalLayers)
{
_layerStatusModels.Add(new LayerStatusModel(layer.Name, "Unknown"));
}
// Set models list as a itemssource
layerStatusListView.ItemsSource = _layerStatusModels;
// Event for layer view state changed
MyMapView.LayerViewStateChanged += OnLayerViewStateChanged;
// Provide used Map to the MapView
MyMapView.Map = myMap;
}