private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e)
{
try
{
// Define the selection tolerance
double tolerance = 5;
// Convert the tolerance to map units
double mapTolerance = tolerance * MyMapView.UnitsPerPixel;
// Define the envelope around the tap location for selecting features
var selectionEnvelope = new Envelope(e.Location.X - mapTolerance, e.Location.Y - mapTolerance, e.Location.X + mapTolerance,
e.Location.Y + mapTolerance, MyMapView.Map.SpatialReference);
// Define the query parameters for selecting features
var queryParams = new QueryParameters();
// Set the geometry to selection envelope for selection by geometry
queryParams.Geometry = selectionEnvelope;
// Select the features based on query parameters defined above
await _featureLayer.SelectFeaturesAsync(queryParams, SelectionMode.New);
}
catch (Exception ex)
{
var message = new MessageDialog(ex.ToString(), "An error occured").ShowAsync();
}
}
}