ArcGIS Pro 3.0 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
    await QueuedTask.Run(() =>
    {
      var fields = new List<string> { "Type" }; //field to be used to retrieve unique values
      CIMPointSymbol pointSym = SymbolFactory.Instance.ConstructPointSymbol(
                ColorFactory.Instance.GreenRGB, 16.0, SimpleMarkerStyle.Pushpin);  //constructing a point symbol as a template symbol
      CIMSymbolReference symbolPointTemplate = pointSym.MakeSymbolReference();
    
      //constructing renderer definition for unique value renderer
      UniqueValueRendererDefinition uniqueValueRendererDef =
          new UniqueValueRendererDefinition(fields, symbolPointTemplate);
    
      //creating a unique value renderer
      var flyr = MapView.Active.GetSelectedLayers()[0] as FeatureLayer;
      CIMUniqueValueRenderer uniqueValueRenderer = flyr.CreateRenderer(uniqueValueRendererDef) as CIMUniqueValueRenderer;
    
      //setting the renderer to the feature layer
      flyr.SetRenderer(uniqueValueRenderer);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also