Skip To Content ArcGIS for Developers Sign In Dashboard

Map reference scale

Set a map reference scale


<UserControl x:Class="ArcGISRuntime.WPF.Samples.MapReferenceScale.MapReferenceScale"
        <esri: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}"
                                <!-- Runs are used to format a plain double to match the convention for writing map scales. -->
                                <Run Text="1:" />
                                <Run Text="{Binding Path=.,StringFormat=n0}" />
                <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 DataType="esri: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}" />
                    <!-- A run is used to format the label. -->
                    <Run Text="Current map scale: " />
                    <Run Text="1:" />
                    <Run Text="{Binding ElementName=MyMapView,Path=MapScale,Mode=OneWay,StringFormat=n0}" />

In this topic
  1. Code