ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / UniqueValueRendererDefinition Class / UniqueValueRendererDefinition Constructor / UniqueValueRendererDefinition Constructor(List<String>,CIMSymbolReference,CIMColorRamp,CIMSymbolReference,Boolean)
One or more fields be used to get unique values or combination of values from.
A symbol that will be used to draw features whose values are not found in values list.
A color ramp be used to pick color for symbols from.
A symbol that will be used to draw features whose values are not found in values list.
A boolean indicates whether the DefaultSymbol will be used to draw features whose values are not found in the values list or not.
Example

In This Topic
    UniqueValueRendererDefinition Constructor(List<String>,CIMSymbolReference,CIMColorRamp,CIMSymbolReference,Boolean)
    In This Topic
    Creates a UniqueValueRendererDefinition.
    Syntax
    Public Function New( _
       ByVal fields As List(Of String), _
       Optional ByVal symbolTemplate As CIMSymbolReference, _
       Optional ByVal colorRamp As CIMColorRamp, _
       Optional ByVal defaultSymbol As CIMSymbolReference, _
       Optional ByVal useDefaultSymbol As Boolean _
    )

    Parameters

    fields
    One or more fields be used to get unique values or combination of values from.
    symbolTemplate
    A symbol that will be used to draw features whose values are not found in values list.
    colorRamp
    A color ramp be used to pick color for symbols from.
    defaultSymbol
    A symbol that will be used to draw features whose values are not found in values list.
    useDefaultSymbol
    A boolean indicates whether the DefaultSymbol will be used to draw features whose values are not found in the values list or not.
    Example
    Set unique value renderer to the selected feature layer of the active map
    {
        //field to be used to retrieve unique values
        //Note: Run within a QueuedTask
        var fields = new List<string> { "Type" };
        //constructing a point symbol as a template symbol
        CIMPointSymbol pointSym = SymbolFactory.Instance.ConstructPointSymbol(
            ColorFactory.Instance.GreenRGB, 16.0, SimpleMarkerStyle.Pushpin);
        CIMSymbolReference symbolPointTemplate = pointSym.MakeSymbolReference();
    
        //constructing renderer definition for unique value renderer
        UniqueValueRendererDefinition uniqueValueRendererDef =
      new UniqueValueRendererDefinition(fields, symbolPointTemplate);
    
        //creating a unique value renderer
        CIMUniqueValueRenderer uniqueValueRenderer = featureLayer.CreateRenderer(uniqueValueRendererDef) as CIMUniqueValueRenderer;
    
        //setting the renderer to the feature layer
        featureLayer.SetRenderer(uniqueValueRenderer);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also