The slider control allows you to implement Carousel like functionality where you can swipe left and right to display different items:
The current naming of Slider control and Slider line control is a bit confusing. We will rename Sliderline control to Slider control, and Slider control to something like Scroll control in the future.
# Add list of items to slider control
Let's create three instances of the Dog class and use the list of dogs in the slider control. The Dog class looks like this.
## Setup the page
Add the slider control and center it.
Insert an image control within the slider control
Add a label on top of the image control
Add a button outside the label control
## Add code to main page
Add the variable dogs that holds the list of dogs
Add an event handler to capture swipe events
Add an event to capture button click event
Setup the dog array
The slide fires an SCDWidgetsSlideEvent when the slider control is swiped left or right:
a. Create a reference to slider and cast to **SCDWidgetsSlider** b. use the <Slider>.**onSlide** array to add a **SCDWidgetsSlideEventHandler** c. the SCDWidgetsSlideEvent has two attributes, **to** and **from**, to indicate the position change
## Bind to slider control using binding tab
a. bind list, name and imageUrl b. Important! Set the field **contentPriority** to false
# Slide to a specific item
The item count starts at zero, so to goto 2nd item, set <sliderControl>.selected = 1