Jan 07
This is a new request by Benoit. He said he doesn’t know how to detect double click in Silverlight. Well, the answer is simple, Silverlight doesn’t have any support for double clicking yet.
Is it funny? Anyway, there still a lot of methods and work around to simulate double click. Today, I will show you one.
Not only double clicking, Silverlight doesn’t have native support for mouse scroll as well. However, I think the problems will be solved in Silverlight 3. Let’s look forward!
Comparison
Flash implementation: 20 minutes
Silverlight implementation: 30 minutes (Implemented First)
Source codes
Double Click [Flash 9, AS3] (10.9 KiB, 524 hits)
Double Click [Silverlight 2, C#] (11.9 KiB, 1,195 hits)

January 7th, 2009 at 2:15 am
verry verry well (y) :)
January 7th, 2009 at 2:29 am
Done and redone in less than a minute with Flash.
January 7th, 2009 at 2:36 am
actually, there are some strange behavious when using detecting double click in Flash.
If you add the polygons onto the Sprite other than to the stage, you will find that double click can’t be detected on top of the polygon.
January 7th, 2009 at 2:51 am
The Silverlight code is not checking if the mouse moved between clicks. You can click in two different places and get the code to register a double click. Also, there is no need to have a timer running. Just store the time and position of the previous click and compare.
January 7th, 2009 at 3:19 am
Colin,
you are right, position can be checked as well.
The timer can be skipped as well. I use it mainly for simplify the calculation.
January 7th, 2009 at 4:06 am
Would be nice to have a sample as well for right-clicking and context menu :)
January 7th, 2009 at 5:47 am
Strange. When I use mouse everything works OK, but when I use a Wacom tablet, Flash does not recognize double clicks (double taps), Silverlight work OK with pen (stylus).
January 7th, 2009 at 6:33 am
Silverlight , flash, javafx, what good is it when most developers can’t design jack and have no imagination when it comes to GUI?
Now Silverlight, nice try M$!
January 7th, 2009 at 4:11 pm
This is really poor - how can Silverlight have been released without support for double-click and mouse scrolling which are things needed in a GUI. I’m disappointed…
January 7th, 2009 at 6:34 pm
Thank you for this post.
It was realy usefull.
[]´s
January 8th, 2009 at 2:24 am
ethings, the beauty of Silverlight is that it (normally) splits the design into a XAML file for designers and the code into a separate file for the developers. It’s not perfect, but its a significan improvement to Flash’s monolithic approach.
January 8th, 2009 at 9:14 pm
Nice to see debate here. Personally, I think the Silverlight event UI is half-baked. Would be nice to have OnDoubleClick and OnScroll events shipping with the standard implementation. Maybe a ClickCount property attached to the Click event object to detect multi-clicks instead?
Furthermore, I feel that Silverlight NEEDS an i-Phone approach, where there are specific events for multiple UI activity like touching and gesturing - tap, double tap, swipe, squeeze, cirlce, etc. Which would give Silverlight a REAL edge over Flash.
The one-click fits all approach of Silverlight is limiting, especially when trying to create mouse-less solutions (Silverlight for Mobile please note).
Happy new year :-)
January 13th, 2009 at 5:55 pm
[...] Silverlight vs Flash: Double Click [...]
April 28th, 2009 at 10:40 pm
Can you make it available under (new)BSD license? I’d like to use it in my project (http://code.google.com/p/cv-web-annotation-toolkit/), but it isn’t compatible with GPL.
Thanks,
Alex
September 28th, 2009 at 8:07 am
[...] is no native support for double click in Silverlight 3. However, Terence Tsang created a sample to tackle this problem. When you double click on the application, a random [...]