单点触摸阅读作为滚动操作

Single Touch Read as Scroll Action

我有一个设计用于触摸屏的 WPF 应用程序。

我使用带有一组图像的列表视图,selected 图像出现在全尺寸图像控件中

在触摸屏上时,只需触摸列表视图项目上的图像,我就可以 select 显示图像,但是我遇到了一个小问题。

当用户触摸屏幕时,用户的手指通常会轻微移动,同时仍与屏幕接触,导致列表视图将触摸解释为滚动请求。

这意味着所需的 selection 只有在用户小心或碰巧在接触屏幕时没有移动时才会实际发生。

我认为这是确定请求滚动操作的阈值的问题,但我找不到解决此问题的方法。

有人可以帮忙吗?

您可以手动切换 PanningMode for the ListView's internal Scrollviewer。以下是获取滚动查看器的方法:

// Get the border of the listview (first child of a listview)
Decorator border = VisualTreeHelper.GetChild(myListView, 0) as Decorator;

// Get scrollviewer
ScrollViewer scrollViewer = border.Child as ScrollViewer;

现在您可以访问滚动查看器PanningMode 属性。

您只能将平移模式设置为 VerticalFirst,一旦手指移动到您喜欢的特定阈值(使用引发的 ManipulationDelta event, and you set it to None again when the finger is released (ManipulationCompleted 事件)。