Show callout

View inMAUIUWPWPFWinUIView on GitHub

Show a callout with the latitude and longitude of user-tapped points.

Image of show callout

Use case

Callouts are used to display temporary detail content on a map. You can display text and arbitrary UI controls in callouts.

How to use the sample

Tap anywhere on the map. A callout showing the WGS84 coordinates for the tapped point will appear.

How it works

  1. Listen for GeoViewTapped events on the map view.
  2. When the user taps, get the tapped location from the Location property of the GeoViewInputEventArgs.
  3. Project the geometry to WGS84 using GeometryEngine.Project.
  4. Create a string to display the coordinates; note that latitude and longitude in WGS84 map to the Y and X coordinates.
  5. Create a new callout definition using a title and the coordinate string.
  6. Display the callout by calling ShowCalloutAt on the map view with the location and the callout definition.

Relevant API

  • CalloutDefinition
  • GeometryEngine.Project
  • GeoViewTappedEventArgs
  • MapView.GeoViewTapped
  • MapView.ShowCalloutAt

Tags

balloon, bubble, callout, flyout, flyover, info window, popup, tap

Sample Code

ShowCallout.xamlShowCallout.xamlShowCallout.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<UserControl
    x:Class="ArcGIS.UWP.Samples.ShowCallout.ShowCallout"
    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 Text="Tap to show a callout."
                       FontWeight="SemiBold"
                       TextAlignment="Center" />
        </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.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close