How to perform an operation while changing the carouselItem?

17 Jan 20251 minute to read

We can perform operation while changing the carouselItem using DidSelectItem event. DidSelectItem event returns the index changed SfCarouselItem.

Delegate Definition:

For getting carousel event, need to inherits SfCarouselDelegate class as like below. All events definitions are mentioned only DelegateClass.

  • C#
  • public class DelegateClass : SfCarouselDelegate
    {
        public override void DidSelectItem(SfCarousel carousel, SfCarouselItem item)
        {
            base.DidSelectItem(carousel, item);
        }
    }

    Delegate initialization

    By initializing the CarouselDelegate with inherited class of SfCarouselDelegate, we can access the events on SfCarousel control.

  • C#
  • carousel.CarouselDelegate = new DelegateClass();