Display an alert message when a graphic is clicked.
Use case
A user may wish to select a graphic on a map to view relevant information about it.
How to use the sample
Select a graphic to identify it. You will see an alert message displayed.
How it works
- Create a
GraphicsOverlay
and add it to theMapView
. - Add a
Graphic
along with aSimpleFillSymbol
to the graphics overlay. - Create a
Point
from the location clicked on the map view by the user. - Identify the graphic on the map view with
IdentifyGraphicsOverlayAsync(graphicsOverlay, pointClicked, tolerance, max results)
.
Relevant API
- Graphic
- GraphicsOverlay
- MapView
Tags
graphics, identify
Sample Code
<UserControl x:Class="ArcGISRuntime.WinUI.Samples.IdentifyGraphics.IdentifyGraphics"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
<Grid>
<esriUI:MapView x:Name="MyMapView" />
<Border Style="{StaticResource BorderStyle}">
<TextBlock FontWeight="SemiBold"
Text="Tap to identify the graphic."
TextAlignment="Center"
TextWrapping="Wrap" />
</Border>
</Grid>
</UserControl>