private async void MapView_Tapped(object sender, GeoViewInputEventArgs e) { // Clear any existing selection. _damageLayer.ClearSelection(); try { // Perform an identify to determine if a user tapped on a feature. IdentifyLayerResult identifyResult = await _myMapView.IdentifyLayerAsync(_damageLayer, e.Position, 2, false); // Do nothing if there are no results. if (!identifyResult.GeoElements.Any()) { return; } // Get the selected feature as an ArcGISFeature. It is assumed that all GeoElements in the result are of type ArcGISFeature. GeoElement tappedElement = identifyResult.GeoElements.First(); ArcGISFeature tappedFeature = (ArcGISFeature)tappedElement; // Select the feature. _damageLayer.SelectFeature(tappedFeature); // Create the view controller. AttachmentsTableView attachmentsTableViewController = new AttachmentsTableView(tappedFeature); // Present the view controller. NavigationController.PushViewController(attachmentsTableViewController, true); // Deselect the feature. _damageLayer.ClearSelection(); } catch (Exception ex) { ShowMessage(ex.ToString(), "Error selecting feature"); } }
public AttachmentsTableSource(AttachmentsTableView controller, ArcGISFeature selectedFeature, IReadOnlyList <Attachment> attachments) { _attachments = attachments.Where(attachment => attachment.ContentType == "image/jpeg").ToList(); _selectedFeature = selectedFeature; _viewController = controller; }