Hi,
I am displaying a pop-up after a layer has been added to the active map. Two things need to be configured for the pop-up. One is to create an expression for the pop-up's display field. That is working correctly.
The second thing I want to implement is not to display all the fields of that layer (which is pop-up's default implementation), but to display some of those fields.
This is how I am creating an expression for the display field of the pop-up
var cimFeatureDefinition = layer.GetDefinition() as CIMBasicFeatureLayer;
var cimDisplayTable = cimFeatureDefinition.FeatureTable;
cimDisplayTable.DisplayExpressionInfo = new CIMExpressionInfo
{
Expression = DisplayExpression,
Title = "Custom"
};
var baseLayer = cimFeatureDefinition as CIMBaseLayer;
layer.SetDefinition(baseLayer);
The above code is working correctly.
But the below code to display not all but some fields of the layer in pop-up is not working. Its actually also affecting the above code to work.
var fieldsList = new List<CIMPopupFieldDescription>();
foreach (var field in GetPopupFields())
{
var popupFieldDescription = new CIMPopupFieldDescription
{
Alias = field.AliasName,
FieldName = field.Name
};
fieldsList.Add(popupFieldDescription);
}
var popupInfo = new CIMPopupInfo()
{
FieldDescriptions = fieldsList.ToArray()
};
var featureLayer = layer as FeatureLayer;
var cimFeatureDefinition = featureLayer.GetDefinition() as CIMBasicFeatureLayer;
cimFeatureDefinition.PopupInfo = popupInfo;
var baseLayer = cimFeatureDefinition as CIMBaseLayer;
featureLayer.SetDefinition(baseLayer);
Can someone help me to implement the correct way to display some of the fields in the pop-up?