Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for .NET

Change feature layer renderer

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

Change the appearance of a feature layer with a renderer.


Use case

A feature layer hosted on ArcGIS Online has a preset renderer and will display in an ArcGIS Runtime application with that renderer. However, for example, the color associated with the original renderer may be unsuitable for a company with staff or clients who are color blind, or for presentation with a different set of basemap and operational layers. In these cases, the renderer on the feature layer's data can be set to a more suitable color.

How to use the sample

Use the buttons to toggle between the default and the overridden renderer.

How it works

  1. Create a ServiceFeatureTable from a URL.
  2. Create a FeatureLayer from the service feature table.
  3. Create a new renderer (in this case, a SimpleRenderer).
  4. Set the feature layer's renderer.

Relevant API

  • FeatureLayer.Renderer
  • ServiceFeatureTable
  • SimpleRenderer


feature layer, renderer, visualization

Sample Code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns=""
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        <Button Clicked="OnResetButtonClicked" Text="Reset" Grid.Row="0" Grid.Column="0" />
        <Button Clicked="OnOverrideButtonClicked" Text="Override" Grid.Row="0" Grid.Column="1" />
        <esriUI:MapView x:Name="MyMapView" Grid.Row="1" Grid.ColumnSpan="2" />
// 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.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using System;
using Xamarin.Forms;
using Colors = System.Drawing.Color;

namespace ArcGISRuntime.Samples.ChangeFeatureLayerRenderer
        "Change feature layer renderer",
        "This sample demonstrates how to change renderer for a feature layer. It also shows how to reset the renderer back to the default.",
    public partial class ChangeFeatureLayerRenderer : ContentPage
        //Create and hold reference to the feature layer
        private FeatureLayer _featureLayer;

        public ChangeFeatureLayerRenderer ()
            InitializeComponent ();

            //setup the control references and execute initialization 

        private void Initialize()
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Create uri to the used feature service
            Uri serviceUri = new Uri(

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(serviceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

        private void OnOverrideButtonClicked(object sender, EventArgs e)
            // Create a symbol to be used in the renderer
            SimpleLineSymbol symbol = new SimpleLineSymbol()
                Color = Colors.Blue,
                Width = 2,
                Style = SimpleLineSymbolStyle.Solid

            // Create a new renderer using the symbol just created
            SimpleRenderer renderer = new SimpleRenderer(symbol);

            // Assign the new renderer to the feature layer
            _featureLayer.Renderer = renderer;

        private void OnResetButtonClicked(object sender, EventArgs e)
            // Reset the renderer to default