We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the SelectedIndex in SfRotator

Platform: Xamarin.iOS |
Control: SfRotator
Tags: sfrotator

Steps to get the SelectedIndex in SfRotator:


Step 1: Add items to rotator using SfRotatorItem.

Step 2: Use the selected index property or e.Index in the selection changed event to get selectedindex of the current SfRotator item.


The following code demonstrates how to get the selectedindex in SfRotator.


namespace RotatorTestApp
    public partial class ViewController : UIViewController
         SfRotator rotator;
        NSMutableArray collection;
        UILabel indexLabel; public ViewController (IntPtr handle) : base (handle)
        public override void ViewDidLoad ()
 base.ViewDidLoad ();
            collection = new NSMutableArray();
            indexLabel = new UILabel();
            indexLabel.Frame = new CGRect(10,340,this.View.Frame.Width,60);
            rotator = new SfRotator();
            rotator.Frame = new CGRect(0,10,this.View.Frame.Width,300);
            indexLabel.Text = "Rotator SelectedIndex is: 0";
            for (int i = 0;i<5;i++)
                SfRotatorItem item = new SfRotatorItem();
                item.View = new UILabel() { Frame = rotator.Frame, Text = "SfRotatorItem " + i };
            rotator.DataSource = collection;
            rotator.SelectionChanged += Rotator_SelectionChanged;
        private void Rotator_SelectionChanged(object sender, SelectionChangedEventArgs e)
            indexLabel.Text = "Rotator SelectedIndex is: " + rotator.SelectedIndex;//e.Index also can be used





Sample image to show the SfRotator Selected index


SfRotator Selected index


Please find the sample from the below link:


2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile