开发者

want to have single and double click on image in WP7 application

I want to implement different functionalities for single and double click on image. I was earlier using Manipulationstarted event .What could be used now? I am u开发者_开发百科sing help from click count

but (e.ClickCount) is not supported


You can do this with the gestures in the Silverlight for Windows Phone Toolkit

e.g.:

<Image Source="filename.png" >
    <Controls:GestureService.GestureListener>
        <Controls:GestureListener 
             Tap="GestureListener_Tap"
             DoubleTap="GestureListener_DoubleTap" />
    </Controls:GestureService.GestureListener>
</Image>

Beware that the tap event will always be called even when the double-tap event is also called. You could attempt to work round this by having a check in the tap event. (You'd need to have a short timer running on a different thread and if the double click isn't tirggered in this time then assume a double click.)

HOWEVER

From a usability point of view, you may make it easier on your users by having a tap event and a context (tap and hold) menu. This will make it much harder for the user to accidentally select the wrong option and it also gets rid of the problem above.

Having an object support both a tap (or click) and double tap event is not common because it's harder to discover or indicate to users and is easy to use the wrong action. Adding a context menu (right click menu on a PC) is the common convention for adding multiple options to users.

There is a ContextMenu also included in the Toolkit.


Shaireen,

Check out my simple blog article here: The simplest way to detect DoubleClick in Silverlight. That should give you the ability to detect both single Click's and DoubleClick's.

Good luck,
Jim McCurdy


You can use Tapped event for single click and DoubleTapped event for double click in windows phone 8.1


Why you don't have your own local counter variable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜