Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for .NET

Custom dictionary style

This code sample is available for these platforms:
View Sample on GitHub

Use a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.

Custom dictionary style

Use case

When symbolizing geoelements in your map, you may need to convey several pieces of information with a single symbol. You could try to symbolize such data using a unique value renderer, but as the number of fields and values increases, that approach becomes impractical. With a dictionary renderer you can build each symbol on-the-fly driven one or more several attribute values and handle a nearly infinite number of unique combinations.

How to use the sample

Pan and zoom the map to see the symbology from the custom dictionary style.

How it works

  1. Create a new DictionarySymbolStyle by passing in the path to the custom style (.stylx).
  2. Create a new DictionaryRenderer, providing the DictionarySymbolStyle.
  3. Apply the dictionary renderer to a feature layer or graphics overlay with the expected attributes.

Relevant API

  • DictionaryRenderer
  • DictionarySymbolStyle
  • DictionarySymbolStyleConfiguration

Offline data

This sample uses the Restaurant.stylx file, which can be found on ArcGIS Online.

About the data

The layer showing a subset of restaurants in Redlands, CA with attributes for rating, style, health score, and open hours is symbolized using a dictionary renderer that displays a single symbol for all of these variables. The renderer uses symbols from a custom dictionary style to show unique symbols based on several feature attributes. The symbols it contains were created using ArcGIS Pro. The logic used to apply the symbols comes from an Arcade script embedded in the stylx file (which is a SQLite database), along with a JSON string that defines expected attribute names and configuration properties.

Additional Information

To learn more about how styles in dictionary renderers work, visit Display symbols from a style with a dictionary renderer. For information about creating your own custom dictionary style, see the open source dictionary-renderer-toolkit.


dictionary, military, renderer, style, stylx, unique value, visualization

Sample Code

    <esriUI:MapView x:Name="MyMapView" />
// Copyright 2019 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 ArcGISRuntime.Samples.Managers;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using System;
using Xamarin.Forms;

namespace ArcGISRuntimeXamarin.Samples.CustomDictionaryStyle
        "Custom dictionary style",
        "Use a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.",
    public partial class CustomDictionaryStyle : ContentPage
        // Path for the restaurants style file.
        private readonly string _stylxPath = DataManager.GetDataFolder("751138a2e0844e06853522d54103222a", "Restaurant.stylx");

        // Uri for the restaurants feature service.
        private readonly Uri _restaurantUri = new Uri("");

        public CustomDictionaryStyle()

        private async void Initialize()
                // Create a new map with a streets basemap.
                Map map = new Map(Basemap.CreateStreets());

                // Create the restaurants layer and add it to the map.
                FeatureLayer restaurantLayer = new FeatureLayer(_restaurantUri);

                // Load the feature table for the restaurants layer.
                await restaurantLayer.FeatureTable.LoadAsync();

                // Open the custom style file.
                DictionarySymbolStyle restaurantStyle = await DictionarySymbolStyle.CreateFromFileAsync(_stylxPath);

                // Create the dictionary renderer with the style file and the field overrides.
                DictionaryRenderer dictRenderer = new DictionaryRenderer(restaurantStyle);

                // Set the restaurant layer renderer to the dictionary renderer.
                restaurantLayer.Renderer = dictRenderer;

                // Set the map's initial extent to that of the restaurants.
                map.InitialViewpoint = new Viewpoint(restaurantLayer.FullExtent);

                // Set the map to the map view.
                MyMapView.Map = map;
            catch (Exception ex)