列表有点击行为吗? [英] Is there a click behavior for a list?
本文介绍了列表有点击行为吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在全景控件上有一个列表视图.我还为 MouseLeftButtonUp 创建了一个事件,但是我发现在全景项目之间滚动时 MousLeftButtonUp 正在触发(这是有道理的,但从用户的角度来看这是意外的).
I have a list view, on a panoramic control. I've also created an event for MouseLeftButtonUp however I find that when scrolling between the panorama items the MousLeftButtonUp is triggering (it makes sense why but it is unexpected from a user perspective).
有没有办法为列表创建点击事件?或者添加一个模拟该行为的行为?
Is there any way to create a click event for a list? Or add a behavior that simulates that?
推荐答案
从工具包中的 Gesture 服务检出 Tap 手势.
Checkout the Tap gesture from the Gesture service that's part of the toolkit.
<ListBox Height="100" HorizontalAlignment="Left" Margin="12,186,0,0" Name="listBox1" VerticalAlignment="Top" Width="460" >
<Controls:GestureService.GestureListener>
<Controls:GestureListener Tap="GestureListener_Tap">
</Controls:GestureListener>
</Controls:GestureService.GestureListener>
<ListBoxItem Content="1"/>
<ListBoxItem Content="2"/>
<ListBoxItem Content="3"/>
<ListBoxItem Content="4"/>
</ListBox>
和
public void GestureListener_Tap(object sender, GestureEventArgs e) {
System.Diagnostics.Debug.WriteLine("tap");
}
这篇关于列表有点击行为吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文