Click or drag to resize

UniqueValueRenderer Class

A custom symbology renderer where the features of a Layer are displayed via groups based upon specified values found in an attribute field. The groups (aka. unique values) are defined as discreet occurrences specified as Values in UniqueValue objects of the UniqueValues collection.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Symbology
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
public class UniqueValueRenderer : Renderer

The UniqueValueRenderer type exposes the following members.

Public propertyCode exampleDefaultLabel
Gets or sets the label used for the default symbol.
Public propertyCode exampleDefaultSymbol
Gets or sets the default symbol this renderer will use.
Public propertyCode exampleFieldNames
Returns one or more field names, these correspond to keys on Graphic attributes.
Public propertyCode exampleRotationExpression
Gets/sets the expression describing how a Graphic's attributes are translated into a rotation to be applied to the Graphic.
(Inherited from Renderer.)
Public propertyRotationType
Gets/sets whether the rotation calculated from the RotationExpression is screen- or map-relative.
(Inherited from Renderer.)
Public propertyCode exampleSceneProperties
Gets or sets the scene properties for the renderer.
(Inherited from Renderer.)
Public propertyCode exampleUniqueValues
Returns each value and related symbol used to render a layer
Public propertyUnknownJson
Gets unknown data from the source JSON.
(Inherited from Renderer.)
Public propertyUnsupportedJson
Gets unsupported data from the source JSON.
(Inherited from Renderer.)
Public methodCode exampleClone
Returns a clone of the Renderer.
(Inherited from Renderer.)
Public methodGetSymbol(GeoElement)
Returns the symbol the renderer uses to represent the supplied GeoElement.
(Inherited from Renderer.)
Public methodGetSymbol(GeoElement, Boolean)
Returns the symbol that should be used to visualize the given GeoElement with override attributes from renderer.
(Inherited from Renderer.)
Public methodToJson
Returns the json representation of the renderer
(Inherited from Renderer.)
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Renderer.)


Example Name: RenderUniqueValues

Render features in a layer using a distinct symbol for each unique attribute value.

Code example screen shot.

// Copyright 2016 Esri.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using System;
using System.Drawing;

namespace ArcGISRuntime.WPF.Samples.RenderUniqueValues
        name: "Unique value renderer",
        category: "Symbology",
        description: "Render features in a layer using a distinct symbol for each unique attribute value.",
        instructions: "The map with the symbolized feature layer will be shown automatically when the sample loads.",
        tags: new[] { "draw", "renderer", "symbol", "symbology", "values" })]
    public partial class RenderUniqueValues
        public RenderUniqueValues()

            // Initialize the sample.

        private void Initialize()
            // Create new Map with basemap.
            Map myMap = new Map(BasemapStyle.ArcGISTopographic);

            // Create URL to the census feature service.
            Uri serviceUri = new Uri(

            // Create service feature table.
            ServiceFeatureTable statesFeatureTable = new ServiceFeatureTable(serviceUri);

            // Create a new feature layer using the service feature table.
            FeatureLayer statesLayer = new FeatureLayer(statesFeatureTable);

            // Create a new unique value renderer.
            UniqueValueRenderer regionRenderer = new UniqueValueRenderer();

            // Add the "SUB_REGION" field to the renderer.

            // Define a line symbol to use for the region fill symbols.
            SimpleLineSymbol stateOutlineSymbol = new SimpleLineSymbol(
                SimpleLineSymbolStyle.Solid, Color.White, 0.7);

            // Define distinct fill symbols for a few regions (use the same outline symbol).
            SimpleFillSymbol pacificFillSymbol = new SimpleFillSymbol(
                SimpleFillSymbolStyle.Solid, Color.Blue, stateOutlineSymbol);
            SimpleFillSymbol mountainFillSymbol = new SimpleFillSymbol(
                SimpleFillSymbolStyle.Solid, Color.LawnGreen, stateOutlineSymbol);
            SimpleFillSymbol westSouthCentralFillSymbol = new SimpleFillSymbol(
                SimpleFillSymbolStyle.Solid, Color.SandyBrown, stateOutlineSymbol);

            // Add values to the renderer: define the label, description, symbol, and attribute value for each.
                new UniqueValue("Pacific", "Pacific Region", pacificFillSymbol, "Pacific"));
                new UniqueValue("Mountain", "Rocky Mountain Region", mountainFillSymbol, "Mountain"));
                new UniqueValue("West South Central", "West South Central Region", westSouthCentralFillSymbol, "West South Central"));

            // Set the default region fill symbol for regions not explicitly defined in the renderer.
            SimpleFillSymbol defaultFillSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Cross, Color.Gray, null);
            regionRenderer.DefaultSymbol = defaultFillSymbol;
            regionRenderer.DefaultLabel = "Other";

            // Apply the unique value renderer to the states layer.
            statesLayer.Renderer = regionRenderer;

            // Add created layer to the map.

            // Assign the map to the MapView.
            MyMapView.Map = myMap;
<UserControl x:Class="ArcGISRuntime.WPF.Samples.RenderUniqueValues.RenderUniqueValues"
             d:DesignHeight="300" d:DesignWidth="300">
        <esri:MapView x:Name="MyMapView"/>
See Also
Additional Examples
Hyperlink to ExampleDescription
DisplayUtilityAssociationsCreate graphics for utility associations in a utility network.
RenderUniqueValuesRender features in a layer using a distinct symbol for each unique attribute value.
TraceUtilityNetworkDiscover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.