Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.72 KB

popup-viewer.md

File metadata and controls

63 lines (45 loc) · 1.72 KB

PopupViewer

Displays information from simple popups.

Features

  • Supports limited text display from HTML-based popups.
  • Supports charts, media, attachments.
  • Supports basic display of fields and values in non-HTML-based popups.

Important: Support for charts, multimedia, and attachments is currently only available for WPF.

Usage

PopupViewer displays popup information using an underlying PopupManager.

The following code shows how to get a Popup for an identify result:

private Popup? GetPopup(IdentifyLayerResult result)
{
    if (result?.Popups?.FirstOrDefault() is Popup popup)
    {
        return popup;
    }

    if (result?.GeoElements?.FirstOrDefault() is GeoElement geoElement)
    {
        if (result.LayerContent is IPopupSource)
        {
            var popupDefinition = ((IPopupSource)result.LayerContent).PopupDefinition;
            if (popupDefinition != null)
            {
                return new Popup(geoElement, popupDefinition);
            }
        }

        return Popup.FromGeoElement(geoElement);
    }

    return null;
}

The following code shows how to get a PopupManager from a Popup:

var manager = new PopupManager(popup);

To display a PopupViewer in the UI:

<esri:PopupViewer x:Name="popupViewer" />

To present a PopupManager in a PopupViewer:

popupViewer.PopupManager = popupManager;