private Task CreateSimplePopupAsync(FeatureLayer fl) { return(QueuedTask.Run(() => { var def = fl.GetDefinition() as CIMFeatureLayer; string popupText = string.Format("{0} ({1}), population {2}", CustomPopupDefinition.FormatFieldName("STATE_NAME"), CustomPopupDefinition.FormatFieldName("STATE_ABBR"), CustomPopupDefinition.FormatFieldName("TOTPOP2010")); //Create a popup definition with text and table //Just add all the table fields by default CustomPopupDefinition popup = new CustomPopupDefinition() { Title = CustomPopupDefinition.FormatTitle( string.Format("{0} (Simple Popup)", CustomPopupDefinition.FormatFieldName(def.FeatureTable.DisplayField))), TextMediaInfo = new TextMediaInfo() { Text = CustomPopupDefinition.FormatText(popupText) }, TableMediaInfo = new TableMediaInfo(fl.GetFeatureClass().GetDefinition().GetFields()) }; fl.SetPopupInfo(popup.CreatePopupInfo()); })); }
/// <summary> /// Create a CIMPopupInfo from the given definition /// </summary> /// <param name="layer"></param> /// <param name="popupDefinition"></param> /// <returns></returns> public static CIMPopupInfo CreatePopupInfo(this Layer layer, CustomPopupDefinition popupDefinition) { return(popupDefinition.CreatePopupInfo()); }