ArcGIS Runtime SDK for WPF - Library Reference
TimeExtentProperty Field
See Also  Example
ESRI.ArcGIS.Client Namespace > Map Class : TimeExtentProperty Field

Identifies the TimeExtent dependency property.

Syntax

Visual Basic (Declaration) 
Public Shared ReadOnly TimeExtentProperty As DependencyProperty
C# 
public static readonly DependencyProperty TimeExtentProperty

Remarks

Property Fields are used for binding to other objects in the code-behind class file. You do not use Property Fields directly in XAML.

Binding is a powerful mechanism to have Properties automatically update when something changes in an application. Typically Binding is performed in the XAML as this is the easiest coding pattern but there may be instances where you want perform binding in code-behind. The various Property Fields allow this to occur.

Setting TimeExtentProperty Field dependency property could have useful applications such as:

  • Automatically updating the Map based upon a specified TimeExtent to demonstrate the importance of temporal issues changing over time.

Note: An example of Binding an ESRI TimeSlider to the Map.TimeExentProperty via the code-behind can be found in the ESRI.ArcGIS.Client.TemporalRenderer Class documentation.

Example

How to use:

Select different dates in the DatePicker Controls to see the effect of performing Binding in code-behind.

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.

Demonstrating how to perform Binding via code-behind.

XAMLCopy Code
<Grid x:Name="LayoutRoot" >
  
  <!-- Add a Map control. -->
  <esri:Map Background="White" HorizontalAlignment="Left" Name="Map1" VerticalAlignment="Top" 
            Height="444" Width="364" Margin="12,36,0,0"
            Extent="-77.69,-13.88,-11.77,52.03">
    
    <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
                                     Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
    
    <esri:FeatureLayer ID="MyFeatureLayer"
                       Url="http://servicesbeta.esri.com/ArcGIS/rest/services/Hurricanes/Hurricanes/MapServer/0"
                       Where="EVENTID = 'Alberto'" 
                       OutFields="*"/>
    
  </esri:Map>
  
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="40" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" 
             Width="638" TextWrapping="Wrap" Margin="6,9,0,0" 
             Text="Change the Start Date and End Date DatePicker controls to see how the Map.TimeExtentProperty could be used." />
  
  <!-- Add two Microsoft DatePicker Controls and some Labels to demonstrate using the Map.TimeExtentProperty. -->
  <sdk:DatePicker Height="23" HorizontalAlignment="Left" Margin="382,57,0,0" Name="StartDate" 
                  VerticalAlignment="Top" Width="120" SelectedDate="8/3/2000" SelectedDateChanged="UpdateMapDate"/>
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="382,38,0,0" 
             VerticalAlignment="Top" Width="120" Content="Start Date:"/>
  
  <sdk:DatePicker Height="23" HorizontalAlignment="Left" Margin="382,276,0,0" Name="EndDate" 
                  VerticalAlignment="Top" Width="120" SelectedDate="8/24/2000" SelectedDateChanged="UpdateMapDate"/>
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="382,259,0,0" 
             VerticalAlignment="Top" Width="120" Content="End Date:"/>
</Grid>
C#Copy Code
// Utilize a global variable for the TimeExtent object
public ESRI.ArcGIS.Client.TimeExtent _myTimeExtent = new ESRI.ArcGIS.Client.TimeExtent();
  
public TimeExtentProperty()
{
  InitializeComponent();
  
  // Bind the _myTimeExtent object to the Map.TimeExtent using the Map.TimeExtentProperty Field
  System.Windows.Data.Binding myBinding = new System.Windows.Data.Binding();
  myBinding.Source = _myTimeExtent;
  Map1.SetBinding(ESRI.ArcGIS.Client.Map.TimeExtentProperty, myBinding);
}
            
private void UpdateMapDate(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
  // Update the _myTimeExtent object with a new Start and End Dates
  _myTimeExtent.Start = StartDate.SelectedDate;
  _myTimeExtent.End = EndDate.SelectedDate;
  
  // Because we are updating the Properties of the _myTimeExtent object and not the object itself
  // the Binding may not work quite like you would expect. You will need to update the Layers
  // individually in the Map using the .Refresh option.
  ESRI.ArcGIS.Client.FeatureLayer myFeatureLayer = Map1.Layers[1];
  myFeatureLayer.Refresh();
  
  // NOTE: You could use the ESRI.Client.Toolkit.TimeSlider for controlling the dates for the 
  // Map.TimeExtentProperty and you would not need to update the Layers with a .Refresh as this
  // logic is handled internally in the ESRI.Client.Toolkit.TimeSlider. See the 
  // ESRI.ArcGIS.Client.TemporalRenderer documentation for an example.
}
VB.NETCopy Code
' Utilize a global variable for the TimeExtent object
Public _myTimeExtent As New ESRI.ArcGIS.Client.TimeExtent
            
Public Sub New()
  InitializeComponent()
  
  ' Bind the _myTimeExtent object to the Map.TimeExtent using the Map.TimeExtentProperty Field
  Dim myBinding As System.Windows.Data.Binding = New System.Windows.Data.Binding()
  myBinding.Source = _myTimeExtent
  Map1.SetBinding(ESRI.ArcGIS.Client.Map.TimeExtentProperty, myBinding)
End Sub
  
Private Sub UpdateMapDate(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs)
  ' Update the _myTimeExtent object with a new Start and End Dates
  _myTimeExtent.Start = StartDate.SelectedDate
  _myTimeExtent.End = EndDate.SelectedDate
  
  ' Because we are updating the Properties of the _myTimeExtent object and not the object itself
  ' the Binding may not work quite like you would expect. You will need to update the Layers
  ' individually in the Map using the .Refresh option.
  Dim myFeatureLayer As ESRI.ArcGIS.Client.FeatureLayer = Map1.Layers(1)
  myFeatureLayer.Refresh()
  
  ' NOTE: You could use the ESRI.Client.Toolkit.TimeSlider for controlling the dates for the 
  ' Map.TimeExtentProperty and you would not need to update the Layers with a .Refresh as this
  ' logic is handled internally in the ESRI.Client.Toolkit.TimeSlider. See the 
  ' ESRI.ArcGIS.Client.TemporalRenderer documentation for an example.
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.