Reputation: 2785
I have a WPF application which is designed to be used on a touch screen.
I use a list view with a set of images, with the selected image appearing in a full size image control
When on touch screen I can select the images simply by touching the image on the list view item however I have a small issue.
When the user touches the screen, often the users finger moves slightly whilst still in contact with the screen, leading to the list view interpreting the touch as a scroll request.
This means that the desired selection only actually happens when the user is careful or happens to have no movement whilst in contact with the screen.
I assume that this is an issue with the threshold at which it determines a scroll action is requested, but I cant find any solution to this problem.
Can anyone help?
Upvotes: 8
Views: 371
Reputation: 386
You could manually toggle the PanningMode for the ListView's internal Scrollviewer. Here is how to get the 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;
Now you can access the scrollviewer PanningMode
property.
You would only set the panningmode to VerticalFirst
once the finger has moved a specific threshold of your taste using the ManipulationDelta event, and you set it to None
again when the finger is released (ManipulationCompleted event raised).
Upvotes: 3