ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayer Class / RecalculateRenderer Method / RecalculateRenderer(Boolean,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.
Indicates whether to preserve the existing symbology or not (optional). Default value is true.

In This Topic
    RecalculateRenderer(Boolean,Boolean) Method
    In This Topic
    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,
       bool preserveSymbols
    )
    Public Overloads Sub RecalculateRenderer( _
       ByVal generateAllUniqueValues As Boolean, _
       Optional ByVal preserveSymbols 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.
    preserveSymbols
    Indicates whether to preserve the existing symbology or not (optional). Default value is true.
    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

    ArcGIS Pro version: 3 or higher.
    See Also