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

UniqueValueRendererDefinition Constructor(List<String>,CIMSymbolReference,CIMColorRamp,CIMSymbolReference,Boolean)
Creates a UniqueValueRendererDefinition.
Syntax

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

ArcGIS Pro version: 3.0 or higher.
See Also