Click or drag to resize

PopupManager Class

Instances of this class represent a popup manager that contains the necessary business logic for displaying and editing popup information for geo-elements. This class is useful, for instance, if you want to create your own View for displaying a Popup.
Inheritance Hierarchy
SystemObject
  Esri.ArcGISRuntime.Mapping.PopupsPopupManager

Namespace:  Esri.ArcGISRuntime.Mapping.Popups
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public class PopupManager : INotifyPropertyChanged

The PopupManager type exposes the following members.

Constructors
  NameDescription
Public methodCode examplePopupManager
Initializes a new instance of the PopupManager class.
Top
Properties
  NameDescription
Public propertyAllowDelete
Gets a value indicating whether or not the popup view should allow deleting.
Public propertyAllowEdit
Gets a value indicating whether or not the popup view should allow editing.
Public propertyAllowEditAttachments
Get a value indicating whether or not the popup view should allow editing the attachments.
Public propertyAllowEditGeometry
Gets a value indicating whether or not the popup view should allow editing the geometry.
Public propertyAttachmentManager
Gets the attachment manager for this popup
Public propertyCustomDescriptionHtml
Gets the text to display as the custom HTML description.
Public propertyDisplayedFields
Gets the PopupField Values that are for display purposes only
Public propertyEditableDisplayFields
Gets the PopupField Values that are editable
Public propertyEditSummary
Gets the edit summary text.
Public propertyFeatureType
gets the current FeatureType, if any, for the GeoElement
Public propertyFormatter
Gets or sets the formatter used for formatting dates and numbers. Defaults to CurrentUICulture.
Public propertyIsEditing
Gets a value indicating whether editing is currently enabled
Public propertyIsGeoElementValid
Gets a value indicating whether or not the GeoElement is in a valid state as far as the values it has set in its attributes and it's geometry.
Public propertyIsGeometryValid
Gets a value indicating whether the geometry is in a valid state for finishing the edit
Public propertyPopup
Gets the Popup instance this manager is based on
Public propertyShowAttachments
Gets a value indicating whether or not the popup view should show the attachments.
Public propertyShowCustomDescriptionHtml
Gets a value indicating whether or not the popup view should show the custom description HTML.
Public propertyShowEditSummary
Gets a value indicating whether or not the popup view should show the edit info summary.
Public propertyShowMedia
Gets a value indicating whether or not the popup view should show the media.
Public propertyShowRelatedRecords
Gets a value indicating whether or not the popup view should show the related records.
Public propertySketchEditor
Gets or sets the geometry editor for editing the feature
Public propertySymbol
Gets the symbol used by the popup's geo-element
Public propertyTitle
The text to display as the popup title.
Public propertyTreatWarningsAsErrors
Gets or sets whether warnings should be treated as errors.
Top
Methods
  NameDescription
Public methodCancelEditing
Cancels the edit and rolls back any edits made to the attributes, geometry or attachments.
Public methodEvaluateExpressionsAsync
Asynchronously evaluates all expressions, including Arcade FeatureSet functions available at Expressions. This method must be called before displaying the popup information in a UI and after FinishEditingAsync so you can use the synchronous methods GetFormattedValue(PopupField), Substitute(String), and the CustomDescriptionHtml property to get the formatted string representation. If there are no Expressions then result array will be empty.
Public methodFinishEditingAsync
Completes the edit against the GeoElement
Public methodGetDomain
Gets the domain for the given field
Public methodGetFieldByName
Returns the PopupField for a given field name.
Public methodGetFieldLabel
Gets the label for the specified PopupField.
Public methodGetFieldType
Gets the type of field for the popup field
Public methodGetFieldValue
Gets the attribute value for the field
Public methodGetFormattedValue
Returns a formatted String representation of the current popup field's value.
Public methodGetMaxLength
Gets the maximum text length of the field
Public methodGetValidationError
Gets the validation error for the specified field - if any.
Public methodGetValidationWarning
Gets the validation warning for the specified field.
Public methodIsNullable
Gets a value indicating whether the provided field allow null values
Public methodIsTypeIdField
Gets a value indicating if the provided field is a type id field
Public methodStartEditing
Starts editing of the GeoElement
Public methodSubstitute
Substitutes attribute values for attribute place-holders in a given template string.
Public methodUpdateValue(Object, PopupField)
Updates the attribute value for a field
Public methodUpdateValue(FeatureTemplate, Boolean)
Updates the attribute value for a field
Top
Events
  NameDescription
Public eventPropertyChanged
Occurs when a property value changes.
Top
Examples

WPF

Example Name: ShowPopup

Show predefined popups from a web map.

Code example screen shot.

C#
// Copyright 2020 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.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Mapping.Popups;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Diagnostics;
using System.Linq;

namespace ArcGISRuntime.WPF.Samples.ShowPopup
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Show popup",
        category: "Layers",
        description: "Show predefined popups from a web map.",
        instructions: "Click on the features to prompt a popup that displays information about the feature.",
        tags: new[] { "feature", "feature layer", "popup", "toolkit", "web map" })]
    public partial class ShowPopup
    {
        public ShowPopup()
        {
            InitializeComponent();
            Initialize();
        }

        private void Initialize()
        {
            // Load the map.
            MyMapView.Map = new Map(new Uri("https://arcgisruntime.maps.arcgis.com/home/item.html?id=fb788308ea2e4d8682b9c05ef641f273"));
        }

        private async void MapViewTapped(object sender, GeoViewInputEventArgs e)
        {
            try
            {
                // Get the feature layer from the map.
                FeatureLayer incidentLayer = MyMapView.Map.OperationalLayers.First() as FeatureLayer;

                // Identify the tapped on feature.
                IdentifyLayerResult result = await MyMapView.IdentifyLayerAsync(incidentLayer, e.Position, 12, true);

                if (result?.Popups?.FirstOrDefault() is Popup popup)
                {
                    // Remove the instructions label.
                    InstructionsLabel.Visibility = System.Windows.Visibility.Hidden;

                    // Create a new popup manager for the popup.
                    MyPopupViewer.PopupManager = new PopupManager(popup);

                    QueryParameters queryParams = new QueryParameters
                    {
                        // Set the geometry to selection envelope for selection by geometry.
                        Geometry = new Envelope((MapPoint)popup.GeoElement.Geometry, 6, 6)
                    };

                    // Select the features based on query parameters defined above.
                    await incidentLayer.SelectFeaturesAsync(queryParams, SelectionMode.New);
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
    }
}
XAML
<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>
See Also
Additional Examples
Hyperlink to ExampleDescription
ShowPopupShow predefined popups from a web map.