Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for .NET

Map reference scale

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

Set the map's reference scale and which feature layers should honor the reference scale.

Image of map reference scale

Use case

Setting a reference scale on a Map fixes the size of symbols and text to the desired height and width at that scale. As you zoom in and out, symbols and text will increase or decrease in size accordingly. When no reference scale is set, symbol and text sizes remain the same size relative to the MapView.

Map annotations are typically only relevant at certain scales. For instance, annotations to a map showing a construction site are only relevant at that construction site's scale. So, when the map is zoomed out that information shouldn't scale with the MapView, but should instead remain scaled with the Map.

How to use the sample

Use the control at the top to set the map's reference scale (1:500,000 1:250,000 1:100,000 1:50,000). Use the menu checkboxes in the layer menu to set which feature layers should honor the reference scale.

How it works

  1. Get and set the reference scale property on the Map object.
  2. Get and set the scale symbols property on each individual FeatureLayer object.

Relevant API

  • Map
  • FeatureLayer

Additional information

The map reference scale should normally be set by the map's author and not exposed to the end user like it is in this sample.


map, reference scale, scene

Sample Code

using System;
using Windows.UI.Xaml.Data;

namespace ArcGISRuntime.UWP.Samples.MapReferenceScale
    class DoubleToScaleStringConverter : IValueConverter
        // Converts a double to a string
        public object Convert(object value, Type targetType, object parameter, string language)
            return $"1:{value:n0}";

        public object ConvertBack(object value, Type targetType, object parameter, string language)
            throw new NotImplementedException();
        <local:DoubleToScaleStringConverter x:Key="DoubleToScaleStringConverter" />
        <esriUI:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
                <TextBlock Text="Choose a map reference scale:"
                           FontWeight="SemiBold" />
                <!-- When the user's selection changes, the SelectedItem binding will apply the value to the Map's ReferenceScale property. -->
                <ComboBox x:Name="ReferenceScaleBox"
                          SelectedItem="{Binding ElementName=MyMapView, Path=Map.ReferenceScale, Mode=TwoWay}"
                            <!-- The value converter converts from a double to a string that looks like a map scale. -->
                            <TextBlock Text="{Binding Converter={StaticResource DoubleToScaleStringConverter}}" />
                <TextBlock Text="Choose layers to apply scale to:"
                           FontWeight="SemiBold" />
                <!-- Binding is used to display the operational layers for the map view's map, no code behind needed. -->
                <ListView ItemsSource="{Binding ElementName=MyMapView,Path=Map.OperationalLayers}"
                        <DataTemplate x:DataType="mapping:FeatureLayer">
                            <!-- When the user interacts with the checkbox, 
                                 the two-way binding will update the ScaleSymbols (bool) property automatically. -->
                            <CheckBox Content="{Binding Name}" IsChecked="{Binding ScaleSymbols, Mode=TwoWay}" />
                    <Run Text="Current map scale: " />
                        Text="{Binding ElementName=MyMapView,Path=MapScale,Mode=OneWay,Converter={StaticResource DoubleToScaleStringConverter}}" />
// 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 Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Symbology;
using Esri.ArcGISRuntime.Tasks;
using Esri.ArcGISRuntime.Tasks.Offline;
using Esri.ArcGISRuntime.UI;
using Esri.ArcGISRuntime.ArcGISServices;
using Esri.ArcGISRuntime.UI.Controls;
using System;
using System.Linq;
using Windows.UI.Xaml.Controls;
using Esri.ArcGISRuntime.Portal;

namespace ArcGISRuntime.UWP.Samples.MapReferenceScale
        name: "Map reference scale",
        category: "Map",
        description: "Set the map's reference scale and which feature layers should honor the reference scale.",
        instructions: "Use the control at the top to set the map's reference scale (1:500,000 1:250,000 1:100,000 1:50,000). Use the menu checkboxes in the layer menu to set which feature layers should honor the reference scale.",
        tags: new[] { "map", "reference scale", "scene" })]
    public partial class MapReferenceScale
        // List of reference scale options.
        private readonly double[] _referenceScales =

        public MapReferenceScale()

        private async void Initialize()
            // Create a portal and an item; the map will be loaded from portal item.
            ArcGISPortal portal = await ArcGISPortal.CreateAsync(new Uri(""));
            PortalItem mapItem = await PortalItem.CreateAsync(portal, "3953413f3bd34e53a42bf70f2937a408");

            // Create the map from the item.
            Map webMap = new Map(mapItem);

            // Display the map.
            MyMapView.Map = webMap;

            // Populate the reference scale choices.
            ReferenceScaleBox.ItemsSource = _referenceScales;

            // NOTE: this sample uses binding, so explicit control of reference scale isn't seen here.
            // See the iOS or Android samples for an implementation that does not rely on data binding.