Show predefined popups from a web map.

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.
How to use the sample
Tap on the features to prompt a popup that displays information about the feature.
How it works
- Create and load a
Mapusing a URL. - Set the map to a
MapViewand listen for itsGeoViewTappedevent. - Use the
GeoView.IdentifyLayerAsync()method to identify the top-most feature. - Set the first
Popupfrom the result’sIdentifyLayerResult.Popupscollection on aPopupViewer. - Display the popup viewer.
Relevant API
- IdentifyLayerResult
- Map
- PopupViewer
About the data
The California Peaks layer contains point features for every mountain peak in California with an elevation that exceeds 14,000 feet (4,267.2 meters) above mean sea level. Each feature contains a predefined popup with information about its associated peak, including an image, chart, and feature table data.
Tags
feature, feature layer, popup, web map
Sample code
// Copyright 2026 Esri.//// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific// language governing permissions and limitations under the License.
using Esri.ArcGISRuntime.Data;using Esri.ArcGISRuntime.Mapping;using Esri.ArcGISRuntime.Mapping.Popups;using Esri.ArcGISRuntime.UI.Controls;using System;using System.Linq;using System.Threading.Tasks;using System.Windows;using System.Windows.Input;
namespace ArcGIS.WPF.Samples.ShowPopup{ [ArcGIS.Samples.Shared.Attributes.Sample( name: "Show popup", category: "Data", description: "Show predefined popups from a web map.", instructions: "Tap on the features to prompt a popup that displays information about the feature.", tags: new[] { "feature", "feature layer", "popup", "web map" })] public partial class ShowPopup { private FeatureLayer _featureLayer; private bool _isIdentifying;
public ShowPopup() { InitializeComponent(); _ = Initialize(); }
private async Task Initialize() { try { // Create and load the web map that contains predefined popups. Map map = new Map(new Uri("https://arcgisruntime.maps.arcgis.com/home/item.html?id=9f3a674e998f461580006e626611f9ad")); await map.LoadAsync();
// Get the layer whose features define the popups. _featureLayer = map.OperationalLayers.OfType<FeatureLayer>().First();
// Listen for taps after the map and its operational layer are ready. MyMapView.GeoViewTapped += MyMapView_GeoViewTapped; MyMapView.Map = map; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
private async void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e) { if (_featureLayer == null || _isIdentifying) return;
_isIdentifying = true; try { // Identify the first feature at the tapped location and request its predefined popup. _featureLayer.ClearSelection(); IdentifyLayerResult result = await MyMapView.IdentifyLayerAsync(_featureLayer, e.Position, 12, false);
if (result.GeoElements.FirstOrDefault() is not Feature feature || result.Popups.FirstOrDefault() is not Popup popup) { PopupViewer.Popup = null; PopupBackground.Visibility = Visibility.Collapsed; return; }
// Select the identified feature and display its popup. _featureLayer.SelectFeature(feature); PopupViewer.Popup = popup; PopupBackground.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } finally { _isIdentifying = false; } }
private void PopupBackground_MouseDown(object sender, MouseButtonEventArgs e) { if (!ReferenceEquals(e.OriginalSource, PopupBackground)) return;
PopupBackground.Visibility = Visibility.Collapsed; PopupViewer.Popup = null; _featureLayer?.ClearSelection(); } }}<UserControl x:Class="ArcGIS.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" /> <Grid x:Name="PopupBackground" Background="#AA333333" MouseDown="PopupBackground_MouseDown" Visibility="Collapsed"> <Border Width="400" MaxHeight="400" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1" Background="White"> <esri:PopupViewer x:Name="PopupViewer" Margin="5" /> </Border> </Grid> </Grid></UserControl>