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

Double Click Not Firing

5 Answers 162 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Anthonie
Top achievements
Rank 1
Anthonie asked on 16 Apr 2012, 10:12 AM
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

5 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 17 Apr 2012, 09:32 AM
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 >>

0
Anthonie
Top achievements
Rank 1
answered on 17 Apr 2012, 12:01 PM
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
0
George
Telerik team
answered on 20 Apr 2012, 09:13 AM
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 >>

0
Lori
Top achievements
Rank 1
answered on 23 Oct 2013, 02:14 PM
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
0
Vladi
Telerik team
answered on 28 Oct 2013, 10:21 AM
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 >>
Tags
ListBox
Asked by
Anthonie
Top achievements
Rank 1
Answers by
George
Telerik team
Anthonie
Top achievements
Rank 1
Lori
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or