Double Click Not Firing

6 posts, 0 answers
  1. Anthonie
    Anthonie avatar
    2 posts
    Member since:
    Jun 2011

    Posted 16 Apr 2012 Link to this post

    Hi,

    I'm binding a RadListbox to a file structure model (through MVVM and Ria Services).

    I want to catch the double click event.  As I understand you can get the number of clicks from the leftmousedown or up event.
    (e.clickcount).

    The leftmousedown event does not fire, and the leftmouseup always return a value of 1.

    Is there a different way to catch a double click event?

    Anthonie
  2. George
    Admin
    George avatar
    1332 posts

    Posted 17 Apr 2012 Link to this post

    Hello Anthonie,


    I will paste the same answer from the other thread. 

    In SL 5 the click count is available only on mouse down - in mouse up the ClickCount is const 1. I would suggest handling the MouseLeftButtonDown for the RadListBoxItem, not for the RadListBox control. This should do the trick.


    Kind regards,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Anthonie
    Anthonie avatar
    2 posts
    Member since:
    Jun 2011

    Posted 17 Apr 2012 Link to this post

    Thank you George,

    My Listbox's itemsource is binded to a custom List<folders>.  

    Should I add a Handler to the ListBox.Items?

    How would the handler be looking?

    I tried:
    this.radListBox1.Items.AddHandler(RadListBox.MouseLeftButtonDownEvent, new EventHandler<System.Windows.Input.MouseButtonEventArgs>(ListItemDoubleClick), true);
    

    But the MouseLeftButtonDovenEvent is not a Routed Event.

    Any other Ideas?

    Anthonie
  5. George
    Admin
    George avatar
    1332 posts

    Posted 20 Apr 2012 Link to this post

    Hello,

    Please, refer to the silverlight forum where you can find more information how to handle mouse click event on list item - http://forums.silverlight.net/t/171651.aspx 

    Hope this helps.

    Greetings,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Lori
    Lori avatar
    2 posts
    Member since:
    Oct 2013

    Posted 23 Oct 2013 Link to this post

    Hi George,
    I have read the page you provide the link to and I still don't understand how to get the custom behavior associated to the RadListBoxItem when the listbox is bound to a property (collection) in a view model. Can you please provide a more specific example/explanation?
    Thanks
    Lori
  7. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 28 Oct 2013 Link to this post

    Hi,

    A possible approach with which you can access a mouse double click event when clicking and item and is to use the MouseDoubleClick of the RadListBox and inside that event access the SelectedItem. The next code snippet shows how the handler should look like:
    <telerik:RadListBox MouseDoubleClick="RadListBox_MouseDoubleClick" .../>

    private void RadListBox_MouseDoubleClick(object sender, Telerik.Windows.Input.MouseButtonEventArgs e)
    {
        var listBox = sender as RadListBox;
        var selectedItem = listBox.SelectedItem;
    }

    Hope this is helpful.

    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner