想要在 WP7 应用程序中单击和双击图像

发布于 2024-10-10 03:31:22 字数 232 浏览 0 评论 0原文

我想为单击和双击图像实现不同的功能。 我之前使用 Manipulationstarted 事件。现在可以使用什么? 我正在使用点击计数的帮助

但不支持 (e.ClickCount)

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 using help from click count

but (e.ClickCount) is not supported

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

勿忘心安 2024-10-17 03:31:22

您可以使用 Silverlight for Windows Phone Toolkit 中的手势来执行此操作,

例如:

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

请注意即使双击事件也被调用,点击事件也将始终被调用。您可以尝试通过检查点击事件来解决此问题。 (您需要在不同的线程上运行一个短计时器,如果此时未触发双击,则假设双击。)

但是,

从可用性的角度来看,您可以让用户更轻松通过点击事件和上下文(点击并按住)菜单。这将使用户更难意外地选择错误的选项,并且还可以解决上述问题。

让对象同时支持点击(或单击)和双击事件并不常见,因为很难发现或向用户指示,并且很容易使用错误的操作。添加上下文菜单(PC 上的右键菜单)是向用户添加多个选项的常见约定。

工具包中还包含一个ContextMenu

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.

神回复 2024-10-17 03:31:22

Shaireen,

在这里查看我的简单博客文章:在 Silverlight 中检测 DoubleClick 的最简单方法。这应该使您能够检测单次点击和双击。

祝你好运,
吉姆·麦柯迪

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

人生戏 2024-10-17 03:31:22

在 Windows Phone 8.1 中,您可以使用 Taped 事件进行单击,使用 DoubleTapped 事件进行双击

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

南街九尾狐 2024-10-17 03:31:22

为什么你没有自己的本地计数器变量。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文