ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / UniqueValueRendererDefinition Class
Members Example

In This Topic
    UniqueValueRendererDefinition Class
    In This Topic
    Represents unique value renderer definition to apply a different symbol to each category of feature within the layer based on one or more fields.
    Object Model
    UniqueValueRendererDefinition ClassCIMColorRamp ClassCIMSymbolReference ClassCIMSymbolReference Class
    public class UniqueValueRendererDefinition : RendererDefinition 
    Public Class UniqueValueRendererDefinition 
       Inherits RendererDefinition
    UniqueValueRendererDefinition class allows you to define parameters to create renderers to draw features based on unique values.
    Once you define a unique value renderer, you can call a FeatureLayer's CreateRenderer and SetRenderer methods to create and assign a renderer to a feature layer.
    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
    Defining a unique value renderer definition
    var uvrDef = new UniqueValueRendererDefinition()
      ValueFields = new List<string> { "ACTYPE" },
      SymbolTemplate = SymbolFactory.Instance.ConstructPointSymbol(
        ColorFactory.Instance.RedRGB, 10, SimpleMarkerStyle.Hexagon)
      ValuesLimit = 5
    //Note: CreateRenderer can only create value classes based on
    //the current events it has received
    Inheritance Hierarchy



    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also