积极答复者
当PanningMode设置为VerticalOnly, ScrollViewer内部元素不响应TouchUp事件

问题
-
元素大概是这样的结构:
<ScrollViewer> <StackPanel> <!--Items--> </StackPanel> </ScrollViewer>
在代码中, 该ScrollViewer(sv): sv.PanningMode = PanningMode.VerticalOnly;
结果, StackPanel中的Item无法正常接受TouchUp事件, 只能接受TouchDown和TouchLeave.
如果将PanningMode设置的那句注释掉的话, Item又可以正常响应所有触摸事件.
这是什么原因呢? 期望大家告知.
我现在的需求是, StackPanel能够伴随Items在ScrollViewer中响应触摸滚动, 同时,点击一个Item会触发事件TouchDown和TouchUp. 请问怎么做才可以获得TouchUp的响应呢?
答案
-
你好,
>>结果, StackPanel中的Item无法正常接受TouchUp事件, 只能接受TouchDown和TouchLeave.
按照你的描述,我用以下代码进行测试:
<ScrollViewer TouchUp="ScrollViewer_TouchUp" PanningMode="VerticalOnly" > <StackPanel> <TextBlock Text="This is a test"/> <TextBlock Text="This is a test"/> <TextBlock Text="This is a test"/> <TextBlock Text="This is a test"/> <!--Omitted--> <TextBlock Text="This is a test"/> </StackPanel> </ScrollViewer>
在我的Surface上,可以正常响应TouchUp事件,如图所示:
根据我的经验,可能是和 StackPanel 中的控件有关,如果需要更多的帮助,最好提供详细的代码。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 Lymim 2014年9月5日 4:51
全部回复
-
你好,
>>结果, StackPanel中的Item无法正常接受TouchUp事件, 只能接受TouchDown和TouchLeave.
按照你的描述,我用以下代码进行测试:
<ScrollViewer TouchUp="ScrollViewer_TouchUp" PanningMode="VerticalOnly" > <StackPanel> <TextBlock Text="This is a test"/> <TextBlock Text="This is a test"/> <TextBlock Text="This is a test"/> <TextBlock Text="This is a test"/> <!--Omitted--> <TextBlock Text="This is a test"/> </StackPanel> </ScrollViewer>
在我的Surface上,可以正常响应TouchUp事件,如图所示:
根据我的经验,可能是和 StackPanel 中的控件有关,如果需要更多的帮助,最好提供详细的代码。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 Lymim 2014年9月5日 4:51