WinForms Carousel

5 posts, 0 answers
  1. Chris Lynch
    Chris Lynch avatar
    15 posts
    Member since:
    Mar 2010

    Posted 23 Oct 2010 Link to this post

    I want to launch a new form after a carousel selected element has rotated into position 
    but I can not find any (end of rotation event) that will allow me to do this.
    Is there one or is there a techinque I can use to simulate this

  2. Peter
    Admin
    Peter avatar
    1144 posts
    Member since:
    Sep 2012

    Posted 28 Oct 2010 Link to this post

    Hello Chris,

    Thank you for writing.

    I would suggest that you handle the SelectedIndexChanged event. This event will be fired when the carousel items are rotated.

    I hope this helps. If you have any other questions or comments, please let me know.

    All the best,
    Peter
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items

  3. Chris Lynch
    Chris Lynch avatar
    15 posts
    Member since:
    Mar 2010

    Posted 28 Oct 2010 Link to this post

    Peter
    Thanks for your suggestion ,but it doesn't help
    That event fires prior to rotation not after rotation has completed.
    Chris

  4. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 29 Oct 2010 Link to this post

    Hello Chris,

    Sadly, currently there is no such thing, but there are 2 ways you can achieve this, either create a custom event on the form that will fire when the animation has completed, either create a custom Carrousel,
    I will post here examples of how to achieve both of these things:

    // create a new Event here
    public event EventHandler EventThatFiresAfterRotationCompleted;
     
    public Form1()
    {
        InitializeComponent();
       // handle the selected index changed operation here, and create a timer that will fire after the animation for the carousel is finalized
        radCarousel1.SelectedIndexChanged += delegate
        {
            var timer = new System.Windows.Forms.Timer();
            timer.Interval = radCarousel1.AnimationDelay * radCarousel1.AnimationFrames;
            timer.Tick += delegate
            {
                timer.Stop();
                if (EventThatFiresAfterRotationCompleted != null)
                {
                    EventThatFiresAfterRotationCompleted(radCarousel1, EventArgs.Empty);
                }
            };
            timer.Start();
        };
         
        //register for event
        this.EventThatFiresAfterRotationCompleted += new EventHandler(Form1_EventThatFiresAfterRotationCompleted);
    }
     
    void Form1_EventThatFiresAfterRotationCompleted(object sender, EventArgs e)
    {
        MessageBox.Show("AnimationCompleted");
    }

    Or the second one with the custom Carrousel:
    public class CustomRadCarousel : RadCarousel
    {
        public event EventHandler EventThatFiresAfterRotationCompleted;
     
        public CustomRadCarousel()
            : base()
        {
            SelectedIndexChanged += delegate
            {
                var timer = new System.Windows.Forms.Timer();
                timer.Interval = this.AnimationDelay * this.AnimationFrames;
                timer.Tick += delegate
                {
                    timer.Stop();
                    RaiseEventThatFiresAfterRotationCompleted();
                };
                timer.Start();
            };
        }
     
        private void RaiseEventThatFiresAfterRotationCompleted()
        {
            if (EventThatFiresAfterRotationCompleted != null)
            {
                EventThatFiresAfterRotationCompleted(this, EventArgs.Empty);
            }
        }
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

  5. Peter
    Admin
    Peter avatar
    1144 posts
    Member since:
    Sep 2012

    Posted 02 Nov 2010 Link to this post

    Hello Chris Lynch,

    Thank you for the provided details.

    I could suggest that you use RadCarousel.CarouselElement's AnimationFinished event.
    This event will be fired when the animation is finished.

    Let me know if you have any other questions.

    Sincerely yours,
    Peter
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items

Back to Top