MicrosoftDocs / windows-dev-docs

Conceptual and overview content for developing Windows apps
Creative Commons Attribution 4.0 International
697 stars 1.2k forks source link

Add information on how to cancel direct manipulation after scrolling begins on a scrolling view #1396

Closed jgold6 closed 4 years ago

jgold6 commented 5 years ago

Based on this MSDN thread: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/6d9abdb1-5d8c-4030-acfd-9a36ae6d3217/uwp-only-the-manipulationstarting-events-fire?forum=wpdevelop , it has been suggested that this document needs to be updated to draw attention to the new APIs for UWP UIElements to cancel direct manipulation of touch events. I cannot edit this document myself as I do not have permission. Here is a proposal for a paragraph to add to the "Routed events" section of this doc:

If it is necessary to handle PointerMoved or other events on a UIElement when that element is in a scrollable view, e.g. ScrollViewer or ListView, then you will need to cancel the scrolling views direct manipulation, e.g. call UIElement.CancelDirectmanipulation(), when you want to start handling those events. When done, call UIElement.TryStartDirectManipulation(Pointer value) so the scrolling view can resume direct manipulation. See the documentation for CancelDirectmanipulation and TryStartDirectManipulation for more details.

In addition it might be worth linking to the "Routed events" section of this document from the API docs for all scrolling controls that use direct manipulation, e.g.: ScrollViewer and ScrollBar: https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/scroll-controls

ListView, GridView, ComboBox: https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/lists

ListBox: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.listbox

FlipView: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.flipview

TreeView: https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/tree-view


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Karl-Bridge-Microsoft commented 4 years ago

Thanks @jgold6. The suggested topics have all been updated.