ArcGIS Runtime SDK for WPF - Library Reference
InitialExtent Property
See Also  Example
ESRI.ArcGIS.Client Namespace > ArcGISTiledMapServiceLayer Class : InitialExtent Property

The initial extent reported by the ArcGISTiledServiceLayer.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property InitialExtent As Envelope
C# 
public Envelope InitialExtent {get;}

Remarks

The Envelope for the InitialExtent is what is provided by ArcGIS Server for the ArcGISTiledMapServiceLayer. It should be noted that depending on the aspect ratio (i.e. Height and Width) of the Map Control, that the what is viewable on the screen for the ArcGISTiledMapServiceLayer could be different than the published InitalExtent when the application first loads. The reason for this is that ArcGIS Server attempts to center the map based upon the extent and maintain the scale subject to the Data View when the service is initially published from ArcMap. If it is desired to specifically set the Extent of the Map Control to be exactly that of the ArcGISTiledMapServiceLayer.InitialExtent, set the Map.Extent to that of the ArcGISTiledMapServiceLayer.InitialExtent in the code-behind.

Example

How to use:

When the applicaiton loads the InitialExtent values of the ArcGISTiledMapServiceLayer will be displayed. Use various Pan/Zoom actions to navigate around the Map. Then click the button to reset the Map.Exent back to the ArcGISTiledMapServiceLayer.InitialExtent.

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.

Reset the Map to the ArcGISTiledMapServiceLayer.InitialExtent.

XAMLCopy Code
<Grid x:Name="LayoutRoot">
  <esri:Map Background="White" Name="Map1" Width="469" Height="315" BorderThickness="1" 
            HorizontalAlignment="Left" VerticalAlignment="Top"
            BorderBrush="Black" WrapAround="True" Margin="159,153,0,0">
  
  <!-- Define an ArcGISTiledMapServiceLayer. -->
  <esri:ArcGISTiledMapServiceLayer 
        Url="http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" />
  
  </esri:Map>
  
  <!-- Reset the Map to the InitialExtent of the ArcGISTiledMapServiceLayer. -->
  <Button Content="Reset to InitialExtent" Height="23" HorizontalAlignment="Left" Margin="12,185,0,0" 
          Name="Button_ResetInitialExtent" VerticalAlignment="Top" Width="140" Click="Button_ResetInitialExtent_Click"/>
  
  <!-- InitialExtent Property (Read Only). -->
  <StackPanel x:Name="InitialExtent" Margin="12,236,0,0" Orientation="Vertical" HorizontalAlignment="Left" 
              VerticalAlignment="Top">
    <sdk:Label Height="28" HorizontalAlignment="Left" Name="Label1" VerticalAlignment="Top" 
               Width="120" Content="InitialExtent:"/>
    <StackPanel Orientation="Horizontal" Height="28">
      <sdk:Label Height="28" HorizontalAlignment="Left" Name="Label2" VerticalAlignment="Top" 
                 Width="40" Content="XMax:"/>
      <TextBlock Height="28" HorizontalAlignment="Left" Name="TextBlock_InitialExtent_XMax" 
                 Text="{Binding ElementName=Map1, Path=Layers[0].InitialExtent.XMax, StringFormat=\{0:F3\}}" 
                 VerticalAlignment="Top" Width="100" />
    </StackPanel>
    <StackPanel Orientation="Horizontal" Height="28">
      <sdk:Label Height="28" HorizontalAlignment="Left" Name="Label3" VerticalAlignment="Top" 
                 Width="40" Content="XMin:"/>
      <TextBlock Height="28" HorizontalAlignment="Left" Name="TextBlock_InitialExtent_XMin" 
                 Text="{Binding ElementName=Map1, Path=Layers[0].InitialExtent.XMin, StringFormat=\{0:F3\}}" 
                 VerticalAlignment="Top" Width="100"/>
    </StackPanel>
    <StackPanel Orientation="Horizontal" Height="28">
      <sdk:Label Height="28" HorizontalAlignment="Left" Name="Label4" VerticalAlignment="Top" 
                 Width="40" Content="YMax:"/>
      <TextBlock Height="28" HorizontalAlignment="Left" Name="TextBlock_InitialExtent_YMax" 
                 Text="{Binding ElementName=Map1, Path=Layers[0].InitialExtent.YMax, StringFormat=\{0:F3\}}" 
                 VerticalAlignment="Top" Width="100"/>
    </StackPanel>
    <StackPanel Orientation="Horizontal" Height="28">
      <sdk:Label Height="28" HorizontalAlignment="Left" Name="Label5" VerticalAlignment="Top" 
                 Width="40" Content="YMin:"/>
      <TextBlock Height="28" HorizontalAlignment="Left" Name="TextBlock_InitialExtent_YMin" 
                 Text="{Binding ElementName=Map1, Path=Layers[0].InitialExtent.YMin, StringFormat=\{0:F3\}}" 
                 VerticalAlignment="Top" Width="100"/>
    </StackPanel>
  </StackPanel>
  
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="107" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="640" 
             TextWrapping="Wrap" Text="When the applicaiton loads the InitialExtent values of the ArcGISTiledMapServiceLayer
             will be displayed. Use various Pan/Zoom actions to navigate around the Map. Then click the button to 
             reset the Map.Exent back to the ArcGISTiledMapServiceLayer.InitialExtent."/>
  
</Grid>
C#Copy Code
private void Button_ResetInitialExtent_Click(object sender, RoutedEventArgs e)
{
  // Reset the Map.Exent back to the ArcGISTiledMapServiceLayer.InitialExtent.
  Map1.Extent = new ESRI.ArcGIS.Client.Geometry.Envelope(
   Convert.ToDouble(TextBlock_InitialExtent_XMin.Text),
   Convert.ToDouble(TextBlock_InitialExtent_YMin.Text),
   Convert.ToDouble(TextBlock_InitialExtent_XMax.Text),
   Convert.ToDouble(TextBlock_InitialExtent_YMax.Text));
}
VB.NETCopy Code
Private Sub Button_ResetInitialExtent_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
  
  ' Reset the Map.Exent back to the ArcGISTiledMapServiceLayer.InitialExtent.
  Map1.Extent = New ESRI.ArcGIS.Client.Geometry.Envelope(CDbl(TextBlock_InitialExtent_XMin.Text),
                                                         CDbl(TextBlock_InitialExtent_YMin.Text),
                                                         CDbl(TextBlock_InitialExtent_XMax.Text),
                                                         CDbl(TextBlock_InitialExtent_YMax.Text))
  
End Sub

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.