Make a custom time slider


PurposeThis sample demonstrates how the map's current time can be controlled using a custom control dialog box. The sample includes code showing how to convert the time values from Windows date and time controls into ArcGIS Time objects. It also shows how you can add and subtract times using the TimeExtent and TimeDuration classes.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample.

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/Time/TimeAwareHurricanes.mxd.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Open the Visual Studio solution file and build the project. This will create a .dll and a type library (.tlb) file in the \bin folder. The .dll gets registered with the ESRI Add-Ins component category.
  2. Start ArcMap and load the TimeAwareHurricanes.mxd map in the folder <Your ArcGIS Developer Kit Install directory>/Samples/data/Time.
  3. Open the Customize dialog box. On the Commands tab, select the Add-In Controls. The Add-In Controls appear, including the Custom Time Control.
  4. Drag the Custom Time Control button onto one of the toolbars and close the Customize dialog box.
  5. Double-click atlantic_hurricanes_2000 to open the layer's properties.
  6. Click the Time tab. Make sure the Enable Time on this layer check box is selected.
  7. Click OK to close the properties panel.
  8. Click the Custom Time Control button.
  9. Note that only a portion of the hurricane data shows on the map. Drag the slider in the Custom Time Control back and forth to interactively change the time. Try using the date picker in the Custom Time Control to go to a specific date.

CustomTimeSliderButton.cs Contains the functionality to manipulate the map's current time and demonstrates how to do time calculations using TimeExtent and TimeDuration classes.
TimeSliderDialog.cs Contains the functionality to convert between ArcGIS TimeExtent objects and Windows date and time controls.
Download the C# files
CustomTimeSliderButton.vb Contains the functionality to manipulate the map's current time and demonstrates how to do time calculations using TimeExtent and TimeDuration classes.
TimeSliderDialog.vb Contains the functionality to convert between ArcGIS TimeExtent objects and Windows date and time controls.
Download the VB.NET files

Download the files for all languages




Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced