private async void Initialize()
{
// Create new Map with basemap
Map myMap = new Map(Basemap.CreateTopographic());
// Create and set initial map area
Envelope initialLocation = new Envelope(
-1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
SpatialReferences.WebMercator);
// Set the initial viewpoint for map
myMap.InitialViewpoint = new Viewpoint(initialLocation);
// Provide used Map to the MapView
MyMapView.Map = myMap;
// Create uri to the used feature service
var serviceUri = new Uri(
"http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");
// Initialize feature table using a url to feature server url
ServiceFeatureTable featureTable = new ServiceFeatureTable(serviceUri);
// Initialize a new feature layer based on the feature table
_featureLayer = new FeatureLayer(featureTable);
// Make sure that the feature layer gets loaded
await _featureLayer.LoadAsync();
// Check for the load status. If the layer is loaded then add it to map
if (_featureLayer.LoadStatus == Esri.ArcGISRuntime.LoadStatus.Loaded)
{
// Add the feature layer to the map
myMap.OperationalLayers.Add(_featureLayer);
}
}