In another area of my application I'd like to display the per-feature label value rendered when Labeling is turned on in ArcMap, i.e. when IGeoFeatureLayer.DisplayAnnotation becomes true.
I have a list of items of type IFeature from say myFeatLayer. I am able to retrieve the layer-level labeling properties, including text formatting, with:
IGeoFeatureLayer geoLayer = (IGeoFeatureLayer)myFeatLayer;
IAnnotateLayerPropertiesCollection anno = pGeoFeatureLayer.AnnotationProperties;
IElementCollection iecp;
IElementCollection iecup;
IAnnotateLayerProperties props;
anno.QueryItem(0, out props, out iecp, out iecup);
ILabelEngineLayerProperties leprops = props as ILabelEngineLayerProperties;
ITextSymbol text = leprops.Symbol;
What I don't know is necessarily how to query an IFeature, and with what (leprops.Expression?), to retrieve the actual value of what will be rendered near each feature by the labeling engine.
Thanks in advance.
leprops.Expression
is the Name. I need the per-feature value. For example,leprops.Expression
would return the string "[FID]". So I think I'll needExpression
to query the feature.