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

WinForms Carousel

4 Answers 92 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Chris Lynch
Top achievements
Rank 1
Chris Lynch asked on 23 Oct 2010, 04:35 PM
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

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 28 Oct 2010, 07:56 AM
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
0
Chris Lynch
Top achievements
Rank 1
answered on 28 Oct 2010, 02:26 PM
Peter
Thanks for your suggestion ,but it doesn't help
That event fires prior to rotation not after rotation has completed.
Chris
0
Emanuel Varga
Top achievements
Rank 1
answered on 29 Oct 2010, 09:36 AM
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
0
Peter
Telerik team
answered on 02 Nov 2010, 01:02 PM
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
Tags
Carousel
Asked by
Chris Lynch
Top achievements
Rank 1
Answers by
Peter
Telerik team
Chris Lynch
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or