ArcGIS Pro 2.9 API Reference Guide
RecalculateRenderer(Boolean) Method

ArcGIS.Desktop.Mapping Namespace > FeatureLayer Class > RecalculateRenderer Method : RecalculateRenderer(Boolean) Method
Indicates whether all the unique values should be generated. Setting this flag to false will generate only the first hundred unique values, if the dataset has that many.
Updates the renderer based on updated values from the data source. This method must be called on the MCT. Use QueuedTask.Run
Syntax
public void RecalculateRenderer( 
   bool generateAllUniqueValues
)
Public Overloads Sub RecalculateRenderer( _
   ByVal generateAllUniqueValues As Boolean _
) 

Parameters

generateAllUniqueValues
Indicates whether all the unique values should be generated. Setting this flag to false will generate only the first hundred unique values, if the dataset has that many.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Error HRESULT {0} has been returned from a call to a COM component
Remarks
If a new unique value is added to the underlying FeatureClass, in case of a unique value renderer, it gets updated with the newly added value. Similarly with class breaks renderer, RecalculateRenderer tries best to preserve the number of class breaks and recalculates the break values based on the updated values.
Calling RecalculateRenderer on a layer with a unique value renderer or class breaks renderer that has a null color ramp (check the renderer's ColorRamp property via the CIM) will throw a System.Runtime.InteropServices.COMException.
Note: Set generateAllUniqueValues = false to restrict the number of regenerated values to be limited to the first 100. This is a useful optimization for those cases where a renderer may contain 100s or 1000s of unique values that would otherwise be regenerated.
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

FeatureLayer Class
FeatureLayer Members
Overload List