Replicate Import Symbology Matching Dialog in ArcObjects?

1622
1
05-31-2013 06:38 AM
RichardBeatty
New Contributor
In Arcmap I can render a layer with same symbolgy applied to different fields by way of re-importing the .lyr file and choosing a Value Field.  How can replicate the functionality in ArcObjects?
0 Kudos
1 Reply
RichardBeatty
New Contributor
Given an IFeatureLayer, "theLayer", one would cast to a IGeoFeatureLayer, then get its IFeatureRenderer and cast that to a IClassBreaksRenderer.  Then it is a s imple matter to set the IClassBreaksRenderer's Field to the field to be rendered.

IGeoFeatureLayer lyr = theLayer as IGeoFeatureLayer;
IFeatureRenderer ifr = lyr.Renderer;
IClassBreaksRenderer cbr = ifr as IClassBreaksRenderer;
cbr.Field = "someFieldName";
0 Kudos