Items Mode
- 2 minutes to read
ASPxTrackBar allows you to display custom items instead of automatically generated decimal scale marks. Populate the ASPxTrackBar.Items collection to activate ASPxTrackBar’s items display mode.
Track bar items are gathered in a ASPxTrackBar.Items collection. Items are represented as TrackBarItem objects. For each item you can define:
- the text displayed as the item label (the TrackBarItem.Text property);
- the unique item value (the TrackBarItem.Value property);
- the text displayed within a value tooltip invoked for the item when it is being selected by an end-user (the TrackBarItem.ToolTip property).
In the items display mode, there is no need to specify the following properties:
- ASPxTrackBar.MinValue - is automatically changed to 0;
- ASPxTrackBar.MaxValue - is automatically changed with respect to items count;
- ASPxTrackBar.LargeTickInterval - not in effect;
- ASPxTrackBar.SmallTickFrequency - not in effect;
- ASPxTrackBar.Step - is automatically changed to 1.
Possible positions to which drag handles can be moved by end-users correspond directly to items from the ASPxTrackBar.Items collection. When an end-user selects an item, the item’s index is assigned to the editor’s ASPxTrackBar.Position (or ASPxTrackBar.PositionStart/ASPxTrackBar.PositionEnd) property.
The type of item values can be centrally specified via the editor’s ASPxTrackBar.ValueType property (by default it is set to Decimal).
Items collection can be filled manually or populated automatically through binding an editor to a data source (via the ASPxTrackBar.DataSourceID and ASPxTrackBar.DataSource properties).