Visual Basic (Declaration) | |
---|---|
Public ReadOnly Property Resolution As Double |
C# | |
---|---|
public double Resolution {get;} |
If no layers are added the default value is -1.#IND. #IND is a NaN (Not a Number). Not a Number is a value of numeric data type representing an undefined or unrepresentable value, especially in floating-point calculations.
The Map.Resolution is constrained by what is specified for the Map.MaxmimumResolution and Map.MinmimumResolution. The Map.Resolution is Read Only.
Setting the Map.MaximumResolution and the Map.MinimumResolution to the same value essentially locks the Map to a specific scale; meaning that you can only Pan around. You can see this demonstrated in the example code in this document.
How to use:
Click the various buttons to see the effect of the getting the Map’s Resolution Property on a Tiled Layer as well as getting and setting the MaximumResolution and MinimumResolution values. If you use the default values in the textboxes for both the ‘Set MaximumResolution’ and ‘Set MinimumResolution’ buttons the Map control will be locked to a single Resolution value and you will only be able to Pan around.
The XAML code in this example is used in conjunction with the code-behind (C# or VB.NET) to demonstrate the functionality.
The following screen shot corresponds to the code example in this page.
XAML | Copy Code |
---|---|
<Grid x:Name="LayoutRoot"> <!-- Add a Map control with an ArcGISTiledMapServiceLayer. --> <esri:Map Background="White" HorizontalAlignment="Left" Margin="12,88,0,0" Name="Map1" VerticalAlignment="Top" Height="380" Width="300"> <esri:ArcGISTiledMapServiceLayer ID="MyTiledLayer" Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/> </esri:Map> <!-- Provide the instructions on how to use the sample code. --> <TextBlock Height="73" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="517" TextWrapping="Wrap" Margin="12,13,0,0" Text="Use the standard Zoom In/Out, keyboard mouse, and touch actions to see how the different Resolution Properties work." /> <!-- Get the current Map.Resolution. --> <Button Content="Get Resolution" Height="23" HorizontalAlignment="Left" Margin="318,88,0,0" Name="Button_Get_Resolution" VerticalAlignment="Top" Width="234" Click="Button_Get_Resolution_Click"/> <sdk:Label Height="20" HorizontalAlignment="Left" Margin="318,115,0,0" Name="Label2" VerticalAlignment="Top" Width="234" Content="Resolution:"/> <sdk:Label Height="20" HorizontalAlignment="Left" Margin="318,133,0,0" Name="Label_Resolution" VerticalAlignment="Top" Width="234" /> <!-- Get/Set the Map.MaximumResolution. --> <Button Content="Get MaximumResolution" Height="23" HorizontalAlignment="Left" Margin="318,191,0,0" Name="Button_Get_MaximumResolution" VerticalAlignment="Top" Width="234" Click="Button_Get_MaximumResolution_Click" /> <sdk:Label Height="20" HorizontalAlignment="Left" Margin="318,216,0,0" Name="Label1" VerticalAlignment="Top" Width="234" Content="MaximumResolution:"/> <sdk:Label Height="20" HorizontalAlignment="Left" Margin="318,234,0,0" Name="Label_MaximumResolution" VerticalAlignment="Top" Width="234" /> <Button Content="Set MaximumResolution" Height="23" HorizontalAlignment="Left" Margin="318,252,0,0" Name="Button_Set_MaximumResolution" VerticalAlignment="Top" Width="234" Click="Button_Set_MaximumResolution_Click"/> <TextBox Height="23" HorizontalAlignment="Left" Margin="318,281,0,0" Name="TextBox_MaximumResolution" VerticalAlignment="Top" Width="234" Text=".0227734375"/> <!-- Get/Set the Map.MinimumResolution. --> <Button Content="Get MinimumResolution" Height="23" HorizontalAlignment="Left" Margin="318,350,0,0" Name="Button_Get_MinimumResolution" VerticalAlignment="Top" Width="234" Click="Button_Get_MinimumResolution_Click"/> <sdk:Label Height="20" HorizontalAlignment="Left" Margin="318,377,0,0" Name="Label3" VerticalAlignment="Top" Width="234" Content="MinimumResolution:"/> <sdk:Label Height="20" HorizontalAlignment="Left" Margin="318,395,0,0" Name="Label_MinimumResolution" VerticalAlignment="Top" Width="234" /> <Button Content="Set Minimum Resolution" Height="23" HorizontalAlignment="Left" Margin="318,413,0,0" Name="Button_Set_MinimumResolution" VerticalAlignment="Top" Width="234" Click="Button_Set_MinimumResolution_Click"/> <TextBox Height="23" HorizontalAlignment="Left" Margin="318,442,0,0" Name="TextBox_MinimumResolution" VerticalAlignment="Top" Width="234" Text=".0227734375"/> </Grid> |
C# | Copy Code |
---|---|
private void Button_Get_Resolution_Click(object sender, System.Windows.RoutedEventArgs e) { // Get the current Map.Resolution Label_Resolution.Content = Map1.Resolution.ToString(); } private void Button_Set_MaximumResolution_Click(object sender, System.Windows.RoutedEventArgs e) { // Set the Map.MaximumResolution Map1.MaximumResolution = System.Convert.ToDouble(TextBox_MaximumResolution.Text); } private void Button_Get_MaximumResolution_Click(object sender, System.Windows.RoutedEventArgs e) { // Get the Map.MaximumResolution Label_MaximumResolution.Content = Map1.MaximumResolution.ToString(); } private void Button_Set_MinimumResolution_Click(object sender, System.Windows.RoutedEventArgs e) { // Set the Map.MinimumResolution Map1.MinimumResolution = System.Convert.ToDouble(TextBox_MinimumResolution.Text); } private void Button_Get_MinimumResolution_Click(object sender, System.Windows.RoutedEventArgs e) { // Get the Map.MinimumResolution Label_MinimumResolution.Content = Map1.MinimumResolution.ToString(); } |
VB.NET | Copy Code |
---|---|
Private Sub Button_Get_Resolution_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) ' Get the current Map.Resolution Label_Resolution.Content = Map1.Resolution.ToString End Sub Private Sub Button_Set_MaximumResolution_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) ' Set the Map.MaximumResolution Map1.MaximumResolution = CDbl(TextBox_MaximumResolution.Text) End Sub Private Sub Button_Get_MaximumResolution_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) ' Get the Map.MaximumResolution Label_MaximumResolution.Content = Map1.MaximumResolution.ToString End Sub Private Sub Button_Set_MinimumResolution_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) ' Set the Map.MinimumResolution Map1.MinimumResolution = CDbl(TextBox_MinimumResolution.Text) End Sub Private Sub Button_Get_MinimumResolution_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) ' Get the Map.MinimumResolution Label_MinimumResolution.Content = Map1.MinimumResolution.ToString End Sub |
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8