Use this option if you want to create the content for the pop-up dynamically when the item is displayed in the window. This is useful if you are going to be showing multiple items in the pop-up window and don't want to generate the content for the item until it is viewed in the window. To take advantage of this dynamic content creation you must derive from the PopupContent class and override the OnCreateHtmlContent method. This method will be called the first time the content for the item is requested.
publicvoid ShowDynamicPopup(MapMember mapMember, List<long> objectIDs)
{
//Get the active map view.
var 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);
}
internalclass 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.
protectedoverride Task<string> OnCreateHtmlContent()
{
return QueuedTask.Run(() => string.Format("<b>Map Member: {0}, ID: {1}</b>", MapMember, IDString));
}
}