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

How to correctly catch a double click event on an item

1 Answer 43 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Franco
Top achievements
Rank 1
Franco asked on 23 Feb 2011, 11:48 AM

Good morning.
I'm studying your demos for RadCarousel, in particular the "First Look" one, and I want to intercept the double click event on an item. I don't know how to do it, as the item hasn't the double click event wired to it. How can I solve this problem?

Thank you

Gianfranco Pesenato

1 Answer, 1 is accepted

Sort by
0
Accepted
Ivan Todorov
Telerik team
answered on 25 Feb 2011, 02:23 PM
Hello Franco,

Thank you for writing.

Please have a look at the radCarousel1_ItemDataBound() method. This is where the visual items are created. You should subscribe to the carouselItem's events, but since the animation starts on the first click, the double click event is never fired. Therefore, I suggest using the MouseDown event and check the number of clicks. Here is a sample code:
private void radCarousel1_ItemDataBound(object sender, ItemDataBoundEventArgs e)
{
    RadButtonElement carouselItem = (RadButtonElement)e.DataBoundItem;
    carouselItem.MouseDown += new MouseEventHandler(carouselItem_MouseDown);
    // ... Other initializations
}
 
void carouselItem_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Clicks > 1)
    {
        MessageBox.Show("Double click");
    }
}

I hope this will help you. Feel free to write back if you have any other question.

Greetings,
Ivan Todorov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Carousel
Asked by
Franco
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Share this question
or