Show popup

View inAndroidFormsUWPWPFiOSView on GitHub

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

Tap 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
15
16
17
18
19
<ContentPage x:Class="ArcGISRuntimeXamarin.Samples.ShowPopup.ShowPopup"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:resources="clr-namespace:Forms.Resources"
             xmlns:toolkit="clr-namespace:Esri.ArcGISRuntime.Toolkit.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Toolkit.Xamarin.Forms">
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView"
                        BindingContext="{x:Reference Name=ResponsiveFormContainer}"
                        GeoViewTapped="MapViewTapped"
                        Style="{StaticResource MapWithFormStyle}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer" HeightRequest="300">
            <Grid>
                <Label x:Name="InstructionsLabel" Text="Tap a feature to display its popup." />
                <toolkit:PopupViewer x:Name="MyPopupViewer" IsVisible="False" />
            </Grid>
        </resources:ResponsiveFormContainer>
    </RelativeLayout>
</ContentPage>

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