ArcGIS API for WPF - Library Reference
TimeExtent Property
See Also  Example Send comments on this topic
ESRI.ArcGIS.Client Namespace > ArcGISDynamicMapServiceLayer Class : TimeExtent Property

Gets the valid TimeExtent object for the ArcGISDynamicMapServiceLayer or null/Nothing if this service does not support time based queries.

Syntax

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

Example

XAMLCopy Code
<StackPanel Name="StackPanel1" Height="400" Width="400" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" >
    <esri:Map Background="White" Name="Map1" Height="200" Width="400">
    
         <!-- Define an ArcGISDynamicMapServiceLayer that has TimeExtent information. -->
         <esri:ArcGISDynamicMapServiceLayer 
              Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer" />
              
    </esri:Map>
    
    <!-- TimeExtent Property (Read Only) -->
    <TextBlock Height="23" Name="TextBlock_TimeExtent" Text="{Binding ElementName=Map1, Path=Layers[0].TimeExtent}" />
</StackPanel>
C#Copy Code
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
     
  // Create an ArcGISDynamicServiceLayer. The Map1 object (a Map class) was previously defined in XAML.
  ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer();
 
     // Add an ArcGISDynamicMapServiceLayer that has a valid TimeExtent.
  myArcGISDynamicMapServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer";
  myArcGISDynamicMapServiceLayer.ID = "MyUniqueName";
  
  myArcGISDynamicMapServiceLayer.Initialized += new EventHandler<EventArgs>(ArcGISDynamicMapServiceLayer_Initialized);
  Map1.Layers.Add(myArcGISDynamicMapServiceLayer);
  
}
             	
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
             	
  // The TextBlock_TimeExtent (a TextBlock object) was defined previously in the XAML.
            
  ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = (ArcGISDynamicMapServiceLayer)Map1.Layers["MyUniqueName"];
             	
  // TimeExtent Property (Read Only)
  if (myArcGISDynamicMapServiceLayer.TimeExtent != null)
  {
    TextBlock_TimeExtent.Text = myArcGISDynamicMapServiceLayer.TimeExtent.ToString(); 
  }
  else
  {
    TextBlock_TimeExtent.Text = "[NO TimeExtent SERVICE]";
  }
  
}
VB.NETCopy Code
Private Sub MainPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
             	
  ' Create an ArcGISDynamicServiceLayer. The Map1 object (a Map class) was previously defined in XAML.
  Dim myArcGISDynamicMapServiceLayer As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
 
     ' Add an ArcGISDynamicMapServiceLayer that has a valid TimeExtent.
  myArcGISDynamicMapServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer"
  myArcGISDynamicMapServiceLayer.ID = "MyUniqueName"
  
  AddHandler myArcGISDynamicMapServiceLayer.Initialized, AddressOf ArcGISDynamicMapServiceLayer_Initialized
  Map1.Layers.Add(myArcGISDynamicMapServiceLayer)
  
End Sub
             	
Private Sub ArcGISDynamicMapServiceLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
             	
  ' The TextBlock_TimeExtent (a TextBlock object) was defined previously in the XAML.
     
  Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer = Map1.Layers("MyUniqueName")
             	
  'TimeExtent Property (Read Only)
  If myArcGISDynamicMapServiceLayer.TimeExtent IsNot Nothing Then
    TextBlock_TimeExtent.Text = myArcGISDynamicMapServiceLayer.TimeExtent.ToString 
  Else
    TextBlock_TimeExtent.Text = "[NO TimeExtent SERVICE]"
  End If
             	
End Sub

Remarks

Only supported for ArcGIS Server from version 10.0 and onward.

The TimeExtent Property provides metadata about the layer’s service. If temporal information is available (meaning it is not null/Nothing) for the geographic data in the layer’s service, then developers can take advantage of using the Map.TimeExtent Property to display snapshots of the temporal data that cover a specified time period (aka. TimeExtent). Once common use case is to bind a TimeSlider Control with the a Map Control to provide an interactive user experience of showing how geographic temporal data changes over time.

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.