Problem: There a gap in the unique values legend for a raster when created programatically


After defining a customized unique value renderer, then removing a class from this renderer and applying it to a raster layer, a gap appears in the legend.


The RasterRenderer’s Update method does not refresh after removing a class from the renderer.

Solution or Workaround

When creating the renderer, add only the classes you are using. If you add all classes to the renderer, and then remove the unused ones, you will get a gap in the legend.