This is a migrated thread and some comments may be shown as answers.

Disable Carousel Item

1 Answer 113 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 27 Jan 2016, 09:45 PM
Just curious if there is any way to disable a carousel item. I do not wish to remove the item, but rather have it still display, but  not able to be selected and be skipped over when one of the scroll buttons is pressed. Is there any way to do this?

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 01 Feb 2016, 04:19 PM
Hi Robert,

You can achieve the desired effect by changing the predefined scroll buttons for the as explained in the following article - Change the Predefined Scroll Buttons. I have created a sample project that implements the logic for the required behavior. In my case, as the DataContext consists of several Employee objects, I would like to skip the item for "Laura". 

You can check what is the top-most item through the TopContainer property of the RadCarousel Panel. Here is the approach:

private void pageLeftButton_Click(object sender, RoutedEventArgs e)
        {
            
            var panel = this.RadCarousel1.FindCarouselPanel() as RadCarouselPanel;
            var topMostItem = panel.TopContainer as CarouselItem;
 
            if ((topMostItem.DataContext as Employee).FirstName != "Anne")
            {
                this.RadCarousel1.FindCarouselPanel().MoveBy(-1);
            }
            else
            {
                this.RadCarousel1.FindCarouselPanel().MoveBy(-2);
            }
        }

 private void pageRightButton_Click(object sender, RoutedEventArgs e)
        {
            var panel = this.RadCarousel1.FindCarouselPanel() as RadCarouselPanel;
            var topMostItem = panel.TopContainer as CarouselItem;
             
            if ((topMostItem.DataContext as Employee).FirstName != "Robert" )
            {
                this.RadCarousel1.FindCarouselPanel().MoveBy(1);
            }
            else
            {
                this.RadCarousel1.FindCarouselPanel().MoveBy(2);
            }
        }

Please update me if the information provided was useful.

Regards,
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Carousel
Asked by
Robert
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or