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

Gets or sets the TimeExtent value(s) associated with the visual thumbs(s) displayed on the TickBar of the TimeSlider Control.

Syntax

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

Example

How to use:

Click the various buttons for each TimeMode setting to see what the effect is on running the TimeSlider and the output that is produced in the Map Control. The buttons in Green are those that use best practices in the setting the TimeSlider .Value and .TimeMode appropriately in conjunction with each other. Click the bottom button ('Get the TimeSliderExtent.Value') before and after using the PlayPauseButton on the TimeSlider control to see how the various TimeSlider.Value's change.

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.

Comparing the various TimeSlider.Value settings for the different TimeSlider.TimeMode options.

XAMLCopy Code
<Grid x:Name="LayoutRoot" Background="White">
  
  <!-- Provide the instructions on how to use the sample code. -->
  <TextBlock Height="63" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" 
           Width="628" TextWrapping="Wrap" Margin="12,0,0,0" 
           Text="Click the various buttons for each TimeMode setting to see what the effect is on running 
           the TimeSlider and the output that is produced in the Map Control. The buttons in Green are 
           those that use best practices in the setting the TimeSlider .Value and .TimeMode appropriately 
           in conjunction with each other. Click the bottom button ('Get the TimeSliderExtent.Value') 
           before and after using the PlayPauseButton on the TimeSlider control to see how the various 
           TimeSlider.Value's change." />
    
  <!--
  Add a Map Control with an ArcGISTiledMapServiceLayer and a FeatureLayer. The ArcGISTiledMapsServiceLayer 
  is the first Layer in Map.LayerCollection and is drawn on the bottom. The FeatureLayer is then added and 
  draws on top. Set the Map.Extent to zoom to the middle of the Atlantic Ocean.
      
  Setting the Map.TimeExtent acts like a Where clause in that only those features/records that fall
  within the set TimeSlider.Value (which is a narrowed TimeExtent) will then be shown. By Binding the 
  Map.TimeExtent to the TimeSlider.Value Property, the Map will automatically update as the thumb on 
  the TimeSlider moves.
  -->
  <esri:Map Name="Map1" Background="White" Height="375" Width="375" Margin="12,93,0,0" 
            VerticalAlignment="Top" HorizontalAlignment="Left" Extent="-96.81,-57.36,-26.16,13.28"
            TimeExtent="{Binding ElementName=TimeSlider1, Path=Value}">
  
    <!-- Add an ArcGISTiledMapsServiceLayer. -->
    <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
          Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
    
    <!--
    The FeatureLayer contains earthquake dats that is restricted to only those with a Magnitude > 7.
    -->
         
    <esri:FeatureLayer ID="MyFeatureLayer"
          Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer/0" 
          OutFields="*" Where="Magnitude > 7" Initialized="FeatureLayer_Initialized"/>
    
  </esri:Map>
  
  <!--
  Add a TimeSlider. The initialization of the TimeSlider Properties (.MinimumValue, .MaximumValue, 
  .Intervals, and .Value) will be handled in the code-behind in the FeatureLayer_Initialized Event.
  -->
  <esri:TimeSlider Name="TimeSlider1" HorizontalAlignment="Left" VerticalAlignment="Top" 
                   Height="25" Width="375" Margin="12,67,0,0"/>
    
  <!-- TimeSlider.TimeMode.CumulativeFromStart section. -->
  <sdk:Label Height="19" HorizontalAlignment="Left" Margin="393,73,0,0" Name="Label1" VerticalAlignment="Top" Width="241" 
             Content="TimeMode.CumulativeFromStart:" FontWeight="Bold"/>
  <Button Content="5th position via 'instance-in-time'" Height="23" HorizontalAlignment="Left" Margin="393,93,0,0" 
          Name="btn1" VerticalAlignment="Top" Width="235" Click="Button_CumulativeFromStart_InstanceInTime"></Button>
  <Button Content="5th to 9th position via 'period-of-time'" Height="23" HorizontalAlignment="Left" Margin="393,123,0,0" 
          Name="btn2" VerticalAlignment="Top" Width="235"  Click="Button_CumulativeFromStart_PeriodOfTime" Background="Lime" AllowDrop="True" />
    
  <!-- TimeSlider.TimeMode.TimeExtent section. -->
  <sdk:Label Height="19" HorizontalAlignment="Left" Margin="393,169,0,0" Name="Label2" VerticalAlignment="Top" Width="235" 
             Content="TimeMode.TimeExtent:" FontWeight="Bold"/>
  <Button Content="5th position via 'instance-in-time'" Height="23" HorizontalAlignment="Left" Margin="393,186,0,0" 
          Name="btn3" VerticalAlignment="Top" Width="235" Click="Button_TimeExtent_InstanceInTime"/>
  <Button Content="5th to 9th position via 'period-of-time'" Height="23" HorizontalAlignment="Left" Margin="393,218,0,0" 
          Name="btn4" VerticalAlignment="Top" Width="235" Click="Button_TimeExtent_PeriodOfTime" Background="Lime" />
    
  <!-- TimeSlider.TimeMode.TimeInstant section. -->
  <sdk:Label Height="28" HorizontalAlignment="Left" Margin="403,262,0,0" Name="Label3" VerticalAlignment="Top" Width="212" 
             Content="TimeMode.TimeInstant:" FontWeight="Bold"/>
  <Button Content="5th position via 'instance-in-time'" Height="23" HorizontalAlignment="Left" Margin="397,280,0,0" 
          Name="btn5" VerticalAlignment="Top" Width="231" Click="Button_TimeInstant_InstanceInTime" Background="Lime" />
  <Button Content="5th to 9th position via 'period-of-time'" Height="23" HorizontalAlignment="Left" Margin="397,309,0,0" 
          Name="btn6" VerticalAlignment="Top" Width="231" Click="Button_TimeInstant_PeriodOfTime"/>
  
  <!-- 
  Useful button to determine the active TimeSlider.Value settings. Use before and after clicking the PlayPauseButton
  on the TimeSlider.
  -->
  <Button Content="Get the TimeSlider.Value" Height="23" HorizontalAlignment="Left" Margin="397,403,0,0" Name="btn7" 
          VerticalAlignment="Top" Width="231" Click="Button_Get_TimeSliderValue"/>
   
</Grid>
C#Copy Code
private void FeatureLayer_Initialized(object sender, System.EventArgs e)
{
  // This function sets up TimeSlider .MinimumValue, .MaximumValue, .Intervals, and the initial starting 
  // .Value that define how the TimeSlider will behave. 
  
  // Get the FeatureLayer with TimeExtent information.
  ESRI.ArcGIS.Client.FeatureLayer myFeatureLayer = (ESRI.ArcGIS.Client.FeatureLayer)sender;
  
  // Obtain the start and end Date/Time values from the TimeSlider.
  DateTime myMinimumDate = myFeatureLayer.TimeExtent.Start;
  DateTime myMaximumDate = myFeatureLayer.TimeExtent.End;
  
  // If you don't set the .MinimumValue and .MaximumValue no TicksMarks get set on the TickBar!
  TimeSlider1.MinimumValue = myMinimumDate;
  TimeSlider1.MaximumValue = myMaximumDate;
  
  // Create a TimeExtent based upon the start and end Date/Times.
  ESRI.ArcGIS.Client.TimeExtent myTimeExtent = new ESRI.ArcGIS.Client.TimeExtent(myMinimumDate, myMaximumDate);
  
  // Create an empty Collection of IEnumerable<DateTime> objects.
  System.Collections.Generic.IEnumerable<DateTime> myIEnumerableDates = null;
  
  // Load all of Dates into the Collection of IEnumerable<DateTime> objects using the 
  // TimeSlider.CreateTimeStopsByCount Shared/Static function.
  myIEnumerableDates = ESRI.ArcGIS.Client.Toolkit.TimeSlider.CreateTimeStopsByCount(myTimeExtent, 20);
  
  // Set the TimeSlider.Intervals which define the Tick marks along the TimeSlider track to the 
  // IEnumerable<DateTime> objects.
  TimeSlider1.Intervals = myIEnumerableDates;
  
  // Define the initial starting position of the thumb along the TimeSlider.
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(myIEnumerableDates.First);
}
            
            
// When using ESRI.ArcGIS.Client.Toolkit.TimeMode.CumulativeFromStart
// ------------------------------------------------------------------
private void Button_CumulativeFromStart_InstanceInTime(object sender, System.Windows.RoutedEventArgs e)
{
  // No observations will initially be will be shown in the Map upon the button click. Once the user clicks 
  // the Play icon of the PlayPauseButton, the TimeSlider1.Value will automatically adjust to a 
  // 'period-of-time' and all observations up to the 6th TickMark of the TickBar will suddenly appear and 
  // then continue to cumulatively display the animation as the thumb moves across the Ticks. If you want 
  // to track a single instance in time use the TimeSlider.TimeMode.Instance enumeration instead.
  //
  // Using this option is not considered a best practice.
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.CumulativeFromStart;
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5));
}
            
private void Button_CumulativeFromStart_PeriodOfTime(object sender, System.Windows.RoutedEventArgs e)
{
  // All observations that fall within the TimeExtent will initially be shown in the Map upon the button click.
  // Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value will continue to use the 
  // 'period-of-time' as the thumb moves across the Ticks.
  //
  // **********************************************************************************************************
  // It is a best practice to use a 'period-of-time' (i.e. a TimeExtent defined with a Start and End Date/Time)
  // TimeSlider.Value setting when using the TimeSlider.TimeMode.CumulativeFromStart.
  // **********************************************************************************************************
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.CumulativeFromStart;
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5), TimeSlider1.Intervals.ElementAt(9));
}
            
            
// When using ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeExtent
// ---------------------------------------------------------
private void Button_TimeExtent_InstanceInTime(object sender, System.Windows.RoutedEventArgs e)
{
  // No observations will initially be will be shown in the Map upon the button click. Once the user clicks the 
  // Play icon of the PlayPauseButton, the TimeSlider1.Value will automatically adjust to a 'period-of-time' that 
  // covers the span of two Tick marks. As the animation occurs of the thumbs moving across the Ticks there will
  // always be a span for the 'period-of-time' that covers two Ticks; this can not be changed. If you want to track
  // a single instance in time use the TimeSlider.TimeMode.Instance enumeration instead.
  //
  // Using this option is not considered a best practice.
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeExtent;
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5));
}
            
private void Button_TimeExtent_PeriodOfTime(object sender, System.Windows.RoutedEventArgs e)
{
  // All observations that fall within the TimeExtent will initially be shown in the Map upon the button click.
  // Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value will continue to use the 
  // 'period-of-time' as the thumb moves across the Ticks.
  //
  // *********************************************************************************************************
  // It is a best practice to use a 'period-of-time' (i.e. a TimeExtent defined with a Start and End Date/Time)
  // TimeSlider.Value setting when using the TimeSlider.TimeMode.TimeExtent.
  // *********************************************************************************************************
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeExtent;
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5), TimeSlider1.Intervals.ElementAt(9));
}
            
            
// When we have ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeInstant
// ------------------------------------------------------------
private void Button_TimeInstant_InstanceInTime(object sender, System.Windows.RoutedEventArgs e)
{
  // No observations will be initially will be shown in the Map upon the button click. This is because the 
  // 'instance-in-time' is a single Date/Time ("1980/05/17 13:53:41 UTC" in XAML) observation for which there
  // is no earthquake event occuring. Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value 
  // will continue to use the 'instance-in-time' (i.e. a TimeExtent with a single Start or End Date/Time) to display
  // earthquake events. Unfortunately, there will never be any earthquake events that display in this option even
  // though it is the correct one to use for the TimeMode.Instant setting. This is because the calculated TickMark
  // intervals from using the TimeSlider.CreateTimeStopsByCount Shared/Static function never coincide with an
  // actual earthquake event. When using the TimeMode.TimeInstant make sure and use data and/or an algorithm
  // that will produce TickMark intervals that coincide with the data values being displayed.
  //
  // ***************************************************************************************************************
  // It is a best practice to use a 'instance-of-time' (i.e. a TimeExtent defined with just a Start or End Date/Time)
  // TimeSlider.Value setting when using the TimeSlider.TimeMode.TimeInstant
  // ***************************************************************************************************************
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeInstant;
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5));
}
            
private void Button_TimeInstant_PeriodOfTime(object sender, System.Windows.RoutedEventArgs e)
{
  // All observations that fall within the TimeExtent will initially be shown in the Map upon the button click.
  // Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value will continue to use the 
  // 'instance-in-time' (i.e. a TimeExtent with a single Start or End Date/Time) to display
  // earthquake events. Unfortunately, there will never be any earthquake events that display in this option 
  // because the calculated TickMark intervals from using the TimeSlider.CreateTimeStopsByCount Shared/Static 
  // function never coincide with an actual earthquake event. When using the TimeMode.TimeInstant make sure and 
  // use data and/or an algorithm that will produce TickMark intervals that coincide with the data values being 
  // displayed.
  //
  // Using this option is not considered a best practice as the TimeSlider will automatically convert the
  // TimeSlider.Value from a 'period-of-time' to an 'instance-in-time' for the TimeExtent values being emmited.
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeInstant;
  TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5), TimeSlider1.Intervals.ElementAt(9));
}
            
private void Button_Get_TimeSliderValue(object sender, System.Windows.RoutedEventArgs e)
{
  // Use this function after hitting each button to the the acutal TimeSlider.Value output. It is also
  // helpful to start and then pause the TimeSlider and then use this function to see how the TimeSlider.Value
  // output data changes.
            
  MessageBox.Show(TimeSlider1.Value.ToString());
}
VB.NETCopy Code
Private Sub FeatureLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
  
  ' This function sets up TimeSlider .MinimumValue, .MaximumValue, .Intervals, and initial starting .Value 
  ' that define how the TimeSlider will behave. 
  
  ' Get the FeatureLayer with TimeExtent information.
  Dim myFeatureLayer As ESRI.ArcGIS.Client.FeatureLayer = sender
  
  ' Obtain the start and end Date/Time values from the TimeSlider.
  Dim myMinimumDate As Date = myFeatureLayer.TimeExtent.Start
  Dim myMaximumDate As Date = myFeatureLayer.TimeExtent.End
  
  ' If you don't set the .MinimumValue and .MaximumValue no TicksMarks get set on the TickBar!
  TimeSlider1.MinimumValue = myMinimumDate
  TimeSlider1.MaximumValue = myMaximumDate
  
  ' Create a TimeExtent based upon the start and end Date/Times.
  Dim myTimeExtent As New ESRI.ArcGIS.Client.TimeExtent(myMinimumDate, myMaximumDate)
  
  ' Create an empty Collection of IEnumerable(Of Date) objects.
  Dim myIEnumerableDates As System.Collections.Generic.IEnumerable(Of Date)
  
  ' Load all of Dates into the Collection of IEnumerable(Of Date) objects using the 
  ' TimeSlider.CreateTimeStopsByCount Shared/Static function.
  myIEnumerableDates = ESRI.ArcGIS.Client.Toolkit.TimeSlider.CreateTimeStopsByCount(myTimeExtent, 20)
  
  ' Set the TimeSlider.Intervals which define the Tick marks along the TimeSlider track to the 
  ' IEnumerable(Of Date) objects.
  TimeSlider1.Intervals = myIEnumerableDates
  
  ' Define the initial starting position of the thumb along the TimeSlider.
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(myIEnumerableDates.First)
  
End Sub
  
            
' When using ESRI.ArcGIS.Client.Toolkit.TimeMode.CumulativeFromStart
' ------------------------------------------------------------------
Private Sub Button_CumulativeFromStart_InstanceInTime(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' No observations will initially be will be shown in the Map upon the button click. Once the user clicks the 
  ' Play icon of the PlayPauseButton, the TimeSlider1.Value will automatically adjust to a 'period-of-time' and 
  ' all observations up to the 6th TickMark of the TickBar will suddenly appear and then continue to cumulatively
  ' display the animation as the thumb moves across the Ticks. If you want to track a single instance in time 
  ' use the TimeSlider.TimeMode.Instance enumeration instead.
  '
  ' Using this option is not considered a best practice.
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.CumulativeFromStart
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5))
  
End Sub
            
Private Sub Button_CumulativeFromStart_PeriodOfTime(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' All observations that fall within the TimeExtent will initially be shown in the Map upon the button click.
  ' Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value will continue to use the 
  ' 'period-of-time' as the thumb moves across the Ticks.
  '
  ' **********************************************************************************************************
  ' It is a best practice to use a 'period-of-time' (i.e. a TimeExtent defined with a Start and End Date/Time)
  ' TimeSlider.Value setting when using the TimeSlider.TimeMode.CumulativeFromStart.
  ' **********************************************************************************************************
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.CumulativeFromStart
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5), TimeSlider1.Intervals.ElementAt(9))
  
End Sub
            
            
' When using ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeExtent
' ---------------------------------------------------------
Private Sub Button_TimeExtent_InstanceInTime(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' No observations will initially be will be shown in the Map upon the button click. Once the user clicks the 
  ' Play icon of the PlayPauseButton, the TimeSlider1.Value will automatically adjust to a 'period-of-time' that 
  ' covers the span of two Tick marks. As the animation occurs of the thumbs moving across the Ticks there will
  ' always be a span for the 'period-of-time' that covers two Ticks; this can not be changed. If you want to track
  ' a single instance in time use the TimeSlider.TimeMode.Instance enumeration instead.
  '
  ' Using this option is not considered a best practice.
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeExtent
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5))
            
End Sub
            
Private Sub Button_TimeExtent_PeriodOfTime(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' All observations that fall within the TimeExtent will initially be shown in the Map upon the button click.
  ' Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value will continue to use the 
  ' 'period-of-time' as the thumb moves across the Ticks.
  '
  ' *********************************************************************************************************
  ' It is a best practice to use a 'period-of-time' (i.e. a TimeExtent defined with a Start and End Date/Time)
  ' TimeSlider.Value setting when using the TimeSlider.TimeMode.TimeExtent.
  ' *********************************************************************************************************
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeExtent
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5), TimeSlider1.Intervals.ElementAt(9))
  
End Sub
            
            
' When we have ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeInstant
' ------------------------------------------------------------
Private Sub Button_TimeInstant_InstanceInTime(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' No observations will be initially will be shown in the Map upon the button click. This is because the 
  ' 'instance-in-time' is a single Date/Time ("1980/05/17 13:53:41 UTC" in XAML) observation for which there
  ' is no earthquake event occuring. Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value 
  ' will continue to use the 'instance-in-time' (i.e. a TimeExtent with a single Start or End Date/Time) to display
  ' earthquake events. Unfortunately, there will never be any earthquake events that display in this option even
  ' though it is the correct one to use for the TimeMode.Instant setting. This is because the calculated TickMark
  ' intervals from using the TimeSlider.CreateTimeStopsByCount Shared/Static function never coincide with an
  ' actual earthquake event. When using the TimeMode.TimeInstant make sure and use data and/or an algorithm
  ' that will produce TickMark intervals that coincide with the data values being displayed.
  '
  ' ***************************************************************************************************************
  ' It is a best practice to use a 'instance-of-time' (i.e. a TimeExtent defined with just a Start or End Date/Time)
  ' TimeSlider.Value setting when using the TimeSlider.TimeMode.TimeInstant
  ' ***************************************************************************************************************
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeInstant
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5))
  
End Sub
            
Private Sub Button_TimeInstant_PeriodOfTime(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' All observations that fall within the TimeExtent will initially be shown in the Map upon the button click.
  ' Once the user clicks the Play icon of the PlayPauseButton, the TimeSlider1.Value will continue to use the 
  ' 'instance-in-time' (i.e. a TimeExtent with a single Start or End Date/Time) to display
  ' earthquake events. Unfortunately, there will never be any earthquake events that display in this option 
  ' because the calculated TickMark intervals from using the TimeSlider.CreateTimeStopsByCount Shared/Static 
  ' function never coincide with an actual earthquake event. When using the TimeMode.TimeInstant make sure and 
  ' use data and/or an algorithm that will produce TickMark intervals that coincide with the data values being 
  ' displayed.
  '
  ' Using this option is not considered a best practice as the TimeSlider will automatically convert the
  ' TimeSlider.Value from a 'period-of-time' to an 'instance-in-time' for the TimeExtent values being emmited.
  
  TimeSlider1.TimeMode = ESRI.ArcGIS.Client.Toolkit.TimeMode.TimeInstant
  TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(TimeSlider1.Intervals.ElementAt(5), TimeSlider1.Intervals.ElementAt(9))
  
End Sub
            
Private Sub Button_Get_TimeSliderValue(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
  
  ' Use this function after hitting each button to the the acutal TimeSlider.Value output. It is also
  ' helpful to start and then pause the TimeSlider and then use this function to see how the TimeSlider.Value
  ' output data changes.
  
  MessageBox.Show(TimeSlider1.Value.ToString)
  
End Sub

Remarks

The TimeSlider Value Property emits TimeExtent value(s) that are typically used in conjunction with the Map Control to enhance the viewing of geographic features that have attributes based upon Date/Time (aka. Time Info in ArcGIS Server terminology) information. In most circumstances, the Value Property is bound to the Map.TimeExtent Property to control the visible geographic features in a Layer that have temporal data.

Note: When a geographic feature has a TimeExtent that falls within the Map.TimeExtent, that feature will be displayed. Conversely, when the TimeExtent of the geographic feature is no longer within the Map.TimeExtent it is no longer displayed.

Setting the Value Property is one of the three necessary properties that must be set in order to have a functioning TimeSlider. The other two necessary properties that must be set are the TimeSlider.MinimumValue and TimeSlider.MaximumValue. Under most circumstances the TimeSlider.Value Property is bound to the Map.TimeExtent Property to have the TimeSlider manage the animation of temporal data in the Map Control. Setting these minimum requirements will enable the TimeSlider to allow the user to manually move the thumb(s) across the TockBar causing an automatic update of what is emitted by the TimeSlider.Value Property to the bound Map.Value Property and thus producing the animation effect on the Map. However, having only the three bare minimum properties set on the TimeSlider will not provide the full functionality of the PlayPauseButton, NextButton, and PreviousButton being visible. In order to have the full functionality of the TimeSlider, the TimeSlider.Intervals Property must also be set.

The setting of the initial Value Property for end users typically corresponds to the left-most TickMark position on the TickBar of the TimeSlider. This enables end users to click the Play icon of the PlayPauseButton to begin an animation from the beginning of the series of temporal geographic observations. There are several ways that a developer could determine what the Date/Time of the left-most TickMark position is. The following is a list of some common ways to determine this left-most Date value:

NOTE: you use Date/Time value(s) to construct the TimeExtent object.

The TimeExtent object that is used by the TimeSlider.Value Property can be essentially constructed two ways: (1) as an 'instance-in-time' or (2) as a 'period-of-time'. Depending on how the TimeExtent object is constructed will have implications for how the TimeSlider behaves when the TimeSlider.Value is set. It is important to remember that a Map Control that is bound to a TimeSlider will only display geographic features that match the TimeSlider.Value Property. The TimeSlider.TimeMode Property also plays crucial role in how the TimeSlider behaves and setting the correct TimeExtent for the TimeSlider.Value will impact the TimeSlider.TimeMode setting. When using the TimeMode Enumerations of CumulativeFromStart and TimeExtent, it is best that you construct the TimeSlider.Value using a 'period-of-time' for the TimeExtent object. When using the TimeMode Enumeration of TimeInstant, it is best that you construct the TimeSlider.Value using an 'instance-in-time' for the TimeExtent object. By default the TimeSlider uses the TimeMode.CumulativeFromStart as its setting. The code example in the TimeSlider.Value document demonstrates the subtle differences you may want to explore.

The following code examples demonstrate manually creating an 'instance-in-time' and 'period-of-time' for a TimeExtent object:

XAML:

            <esri:TimeSlider Name="TimeSlider1" Value="2000/08/04 12:30:00 UTC" /> <!-- instance-in-time --> 
            <esri:TimeSlider Name="TimeSlider1" Value="2000/08/04 12:30:00 UTC, 2000/08/05 12:30:00 UTC" /> <!-- period-of-time -->
            

C#:

            TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(new DateTime(2000, 8, 4, 12, 30, 0)); // instance-in-time
            TimeSlider1.Value = new ESRI.ArcGIS.Client.TimeExtent(new DateTime(2000, 8, 4, 12, 30, 0), new DateTime(2000, 8, 5, 12, 30, 0)); // period-of-time
            

VB.NET:

            TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(New Date(2000, 8, 4, 12, 30, 0)) ' instance-in-time
            TimeSlider1.Value = New ESRI.ArcGIS.Client.TimeExtent(New Date(2000, 8, 4, 12, 30, 0), New Date(2000, 8, 5, 12, 30, 0)) ' period-of-time
            

A word of caution about using the code-behind TimeSlider.Loaded Event if you are trying to obtain the TimeExtent Property of a Layer which contains temporal observations to calculate the TimeSlider.Value and TimeSlider.Intervals; this will not work. The TimeSlider.Loaded event occurs before the various Layer .Initialized Events occur so the Layer's .TimeExtent values will always be Nothing/null. Using the TimeSlider.Loaded Event to determine the TimeSlider.Value and TimeSlider.Intervals Properties is best when the TimeExtent values are known at design-time and the TimeSlider.Value and TimeSlider.Intervals just need constructing in the code-behind.

It is possible to set the TimeSlider.Value Property in XAML using Binding to another object. Just make sure the object you are binding to returns a TimeExtent object. The following is a simple XAML fragment where the TimeSlider.Value is set to the TimeExtent of a FeatureLayer named ‘EarthquakesLayer’:

            <esri:TimeSlider Name="TimeSlider1" Value="{Binding ElementName=MyMap, Path=Layers[EarthquakesLayer].TimeExtent, Mode=OneWay}" />
            

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.