Articles in this section
Category / Section

How to get the SelectedIndex in SfRotator

1 min read

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:

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment