Identify graphics

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Display an alert message when a graphic is clicked.

Image of identify graphics

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

  1. Create a GraphicsOverlay and add it to the MapView.
  2. Add a Graphic along with a SimpleFillSymbol to the graphics overlay.
  3. Create a Point from the location clicked on the map view by the user.
  4. Identify the graphic on the map view with IdentifyGraphicsOverlayAsync(graphicsOverlay, pointClicked, tolerance, max results).

Relevant API

  • Graphic
  • GraphicsOverlay
  • MapView

Tags

graphics, identify

Sample Code

IdentifyGraphics.xamlIdentifyGraphics.xamlIdentifyGraphics.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.IdentifyGraphics.IdentifyGraphics"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <TextBlock Text="Tap to identify the graphic."
                       TextAlignment="Center" TextWrapping="Wrap" FontWeight="SemiBold" />
        </Border>
    </Grid>
</UserControl>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.