Learning ArcGIS Runtime SDK for .NET by Vincent Ron

Learning ArcGIS Runtime SDK for .NET by Vincent Ron

Author:Vincent, Ron
Language: eng
Format: epub
Publisher: Packt Publishing


In MapViewBehavior.cs, add a using statement to Esri.ArcGISRuntime.Layers, and then add a new MapViewTapped event handler to the OnAttached method, like this:AssociatedObject.MapViewTapped += AssociatedObject_MapViewTapped;

In AssociatedObject_MapViewTapped, add the following code:MapView mapView = sender as MapView; OverlayItemsControl overlays = mapView.Overlays; OverlayItemsCollection collection = overlays.Items; System.Windows.Controls.Border overlayControl = (System.Windows.Controls.Border)collection[0]; // get the location tapped on the map var mapPoint = e.Location; // Get possible features and if none found, move to next layer FeatureLayer featureLayer = (FeatureLayer)mapView.Map.Layers[1]; // Get possible features and if none found, move to next layer var foundFeatures = await featureLayer.HitTestAsync(mapView, new Rect(e.Position, new Size(10, 10)), 1); if (foundFeatures.Count() == 0) return; var feature = await featureLayer.FeatureTable.QueryAsync(foundFeatures[0]); overlayControl.DataContext = feature.Attributes; Esri.ArcGISRuntime.Controls.MapView.SetViewOverlayAnchor( overlayControl, mapPoint); overlayControl.Visibility = Visibility.Visible;;



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.