3

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 I replicate this functionality in ArcObjects?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338

1 Answers1

2

Given an IFeatureLayer, "theLayer", one would cast to a IGeoFeatureLayer, then get its IFeatureRenderer and cast that to a IClassBreaksRenderer. Then it is a simple matter to set the IClassBreaksRenderer's Field to the field to be rendered.

IGeoFeatureLayer lyr = theLayer as IGeoFeatureLayer;fixed
IFeatureRenderer ifr = lyr.Renderer;
IClassBreaksRenderer cbr = ifr as IClassBreaksRenderer;
cbr.Field = "someFieldName";
Radar
  • 10,659
  • 9
  • 60
  • 113