Map Scale
This sample demonstrates the map scale changing when you zoom in and out. In .xaml the textblock is binding to the MapControl scale property at runtime. The sample utilitises local data served by the ArcGIS Runtime. The Map.Scale property is used to display the current scale of the map at the bottom of the display.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.MapScale" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid x:Name="LayoutRoot" > <Grid.Resources> <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform CenterY="0.5" CenterX="0.5"/> <SkewTransform CenterY="0.5" CenterX="0.5"/> <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/> <TranslateTransform/> </TransformGroup> </LinearGradientBrush.RelativeTransform> <GradientStop Color="#FF145787" Offset="0.16"/> <GradientStop Color="#FF3D7FAC" Offset="0.502"/> <GradientStop Color="#FF88C5EF" Offset="0.984"/> </LinearGradientBrush> </Grid.Resources> <esri:Map x:Name="MyMap" WrapAround="True" MinimumResolution="2445.98490512499" Extent="-20037507.0671618,-19971868.8804086,20037507.0671618,19971868.8804086"> <esri:ArcGISLocalTiledLayer ID="BaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> </esri:Map> <esri:MapProgressBar x:Name="MyProgressBar" Map="{Binding ElementName=MyMap}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="36" Margin="25" /> <Border Background="White" BorderBrush="#FF999999" BorderThickness="1" Padding="5" CornerRadius="10" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="10" > <TextBlock Name="MapScaleTextBlock" HorizontalAlignment="Center" VerticalAlignment="Bottom" Foreground="Black"> <Run>Map Scale: 1:</Run> <TextBlock Text="{Binding ElementName=MyMap,Path=Scale}" FontSize="12" FontWeight="Bold" Foreground="Black"/> </TextBlock> </Border> </Grid> </UserControl>
5/16/2014