Touch and hold drag to support touch scrolling #459
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changed?
This fixes #360.
I am building a commercial app that is 100% touch, so this feature is critical for me. I hope it will help others. This is my first PR here, so I appreciate your patience and understanding.
To simultaneously support touch drag and scrolling in a scrollable ItemsControl, I updated DragDrop.cs with a touch and hold gesture that will trigger a drag operation after configurable number of milliseconds.
When the user places their finger down, holds, and the timer ticks, it will display an animated adorner under their finger giving them a visual indicator that they can drag the item.
When the touch drag starts, the system sets the ScrollViewer.PanningMode="None" to prevent touch scrolling. The system will remember the previous setting and restore it once the drag is complete.
I added two attached properties to the DragDrop.Properties.cs file to support setting the background color of the touch and hold adorner as well as the touch and hold delay. The default delay is 600 milliseconds.
For the best touch user experience in a scrollable ItemsControl, the following properties should be set on the ItemsControl: