Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cleanest single click + double click handling in Silverlight?

I've been finding various methods of dealing with double click and then the authors slap on some if code for handling single clicks. Is there a standard now in Silverlight 3 that everyone is using to handle both a single and a double click on listboxes?

like image 457
Josh Avatar asked Aug 13 '09 20:08

Josh


1 Answers

If you use the Reactive Extensions (Rx) library the code to support double click is much simpler:

Observable.FromEvent<MouseButtonEventArgs>(myControl, "MouseLeftButtonDown").TimeInterval().Subscribe(evt =>
        {
            if (evt.Interval.TotalMilliseconds <= 300)
            {
                // Do something on double click
            }
        });
like image 141
Flatliner DOA Avatar answered Dec 28 '22 08:12

Flatliner DOA