【发布时间】:2012-05-18 18:08:51
【问题描述】:
我们为鼠标点击手势实现了一个简单的 InputBinding,代码如下:
<Image.InputBindings>
<MouseBinding MouseAction="LeftClick" Command="{Binding OpenDialogCommand}" />
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding OpenDialogCommand}" />
</Image.InputBindings>
我们希望 WPF 能够识别 Left 和 LeftDouble 手势并执行相应的命令。但在实践中我们发现左键点击是先评估的,双击的第二次点击被视为另一个单击。由于我们的命令是打开一个对话框,因此双击将快速打开和关闭我们的对话框。
有没有人遇到过这样的事情?
谢谢。
S.
【问题讨论】:
-
老问题,同样的问题!我在
TextBlock上的这种双输入绑定实际上是这个序列:CLICK CLICK DOUBLECLICK。这些事件也在鼠标按下时处理,not mouse UP。我环顾四周,还没有找到一个简单的解决方案来隔离这些事件。 -
适用于 TextBlock。
标签: wpf xaml mouseevent double-click