Skip to main content
A newer version of this page is available. .

Data Binding

  • 2 minutes to read

Apart from the possibility of creating items and specifying their properties manually, data from a data source can also be used to populate items through the process of binding. The ASPxTrackBar control can be bound to any object that implements the IHierarchicalEnumerable or IHierarchicalDataSource interface (e.g., SiteMapDataSource, XmlDataSource).

A data source can be specified by using either one of these properties of the track bar control:

The ASPxTrackBar control supports two methods used to retrieve data from a specified data source.

Whichever way you choose, the APSxTrackBar control automatically creates TrackBarItem objects and retrieves their property values from the corresponding nodes.

Specifying a data source for a track bar at design-time

You can specify a data source for a track bar at design-time. Invoke ASPxTrackBar’s smart tag and select the “Choose Data Source” menu entry. Select “New Data Source…”.

trackbar_concepts_databinding1

The Data Source Configuration Wizard will start. Select the needed data source type and follow the wizard instructions.

trackbar_concepts_databinding2

Specifying a data source for a track bar in markup

trackbar_example_items_range

The code sample below demonstrates how to bind ASPxTrackBar to an Xml data source.

<?xml version="1.0" encoding="utf-8" ?>
<TimeLapse>
  <Day DayOfWeek="Monday" ToolTip="Monday" Text="Mon" />
  <Day DayOfWeek="Tuesday" ToolTip="Tuesday" Text="Tue" />
  <Day DayOfWeek="Wednesday" ToolTip="Wednesday" Text="Wed" />
  <Day DayOfWeek="Thursday" ToolTip="Thursday" Text="Thu" />
  <Day DayOfWeek="Friday" ToolTip="Friday" Text="Fri" />
  <Day DayOfWeek="Saturday" ToolTip="Saturday" Text="Sat" />
  <Day DayOfWeek="Sunday" ToolTip="Sunday" Text="Sun" />
</TimeLapse>