Show popup

View inAndroidFormsUWPWPFiOSView on GitHubSample viewer app

Show predefined popups from a web map.

Show a popup screenshot

Use case

Many web maps contain predefined popups which are used to display the attributes associated with each feature layer in the map, such as hiking trails, land values, or unemployment rates. You can display text, attachments, images, charts, and web links. Rather than creating new popups to display information, you can easily access and display the predefined popups. The popup viewer control from the ArcGIS Toolkit currently supports label/value displays and plaintext HTML descriptions.

How to use the sample

Click on the features to prompt a popup that displays information about the feature.

How it works

  1. Create and load a Map using a URL.
  2. Use a 'GeoViewTapped' event for when the user clicks on the map.
  3. Use the IdentifyLayerAsync method to identify the top-most feature.
  4. Create a PopupManager using the Popup from the IdentifyLayerResult.
  5. Use the PopupManager to populate the PopupViewer UI element.

Relevant API

  • IdentifyLayerResult
  • Popup
  • PopupManager

About the data

This sample uses a feature layer that displays reported incidents in San Francisco.

Additional information

This sample uses the PopupViewer UI control from the open source ArcGIS Runtime SDK for .NET Toolkit.

Tags

feature, feature layer, popup, toolkit, web map

Sample Code

ShowPopup.xamlShowPopup.xamlShowPopup.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<UserControl x:Class="ArcGISRuntime.WPF.Samples.ShowPopup.ShowPopup"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" GeoViewTapped="MapViewTapped" />
        <Border Style="{StaticResource BorderStyle}">
            <Grid>
                <Label x:Name="InstructionsLabel" Content="Click a feature to display its popup." />
                <esri:PopupViewer x:Name="MyPopupViewer" Width="400" />
            </Grid>
        </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.