ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / PopupContent Class / OnCreateHtmlContent Method
Example

In This Topic
    OnCreateHtmlContent Method
    In This Topic
    Occurs the first time the content for the item is requested. This method is only called if the IsDynamicContent property is true.
    Syntax
    Protected Friend Overridable Function OnCreateHtmlContent() As Task(Of String)
    protected internal virtual Task<string> OnCreateHtmlContent()

    Return Value

    The html content to display in the pop-up.
    Example
    Show A Dynamic Pop-up
    public static void ShowDynamicPopup(MapMember mapMember, List<long> objectIDs)
    {
      MapView mapView = MapView.Active;
      if (mapView == null) return;
      //Create popup whose content is created the first time the item is requested.
      var popups = new List<PopupContent>();
      foreach (var id in objectIDs)
      {
        popups.Add(new DynamicPopupContent(mapMember, id));
      }
      mapView.ShowCustomPopup(popups);
    }
    internal class DynamicPopupContent : PopupContent
    {
      public DynamicPopupContent(MapMember mapMember, long objectID)
      {
        MapMember = mapMember;
        IDString = objectID.ToString();
        IsDynamicContent = true;
      }
    
      //Called when the pop-up is loaded in the window.
      protected override Task<string> OnCreateHtmlContent()
      {
        return QueuedTask.Run(() => string.Format("<b>Map Member: {0}, ID: {1}</b>", MapMember, IDString));
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also