How to correctly catch a double click event on an item

2 posts, 1 answers
  1. Franco
    Franco avatar
    27 posts
    Member since:
    Apr 2010

    Posted 23 Feb 2011 Link to this post

    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

  2. Answer
    Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 25 Feb 2011 Link to this post

    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.

    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!
Back to Top