नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
When a PanGestureRecognizer is attached to a view inside a scrolling view, all of the pan gestures are captured by the PanGestureRecognizer and aren't passed to the scrolling view. Therefore, the scrolling view will no longer scroll.
This iOS platform-specific enables a PanGestureRecognizer in a scrolling view to capture and share the pan gesture with the scrolling view. It's consumed in XAML by setting the Application.PanGestureRecognizerShouldRecognizeSimultaneously attached property to true:
<Application ...
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Application.PanGestureRecognizerShouldRecognizeSimultaneously="true">
...
</Application>
Alternatively, it can be consumed from C# using the fluent API:
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
...
Xamarin.Forms.Application.Current.On<iOS>().SetPanGestureRecognizerShouldRecognizeSimultaneously(true);
The Application.On<iOS> method specifies that this platform-specific will only run on iOS. The Application.SetPanGestureRecognizerShouldRecognizeSimultaneously method, in the Xamarin.Forms.PlatformConfiguration.iOSSpecific namespace, is used to control whether a pan gesture recognizer in a scrolling view will capture the pan gesture, or capture and share the pan gesture with the scrolling view. In addition, the Application.GetPanGestureRecognizerShouldRecognizeSimultaneously method can be used to return whether the pan gesture is shared with the scrolling view that contains the PanGestureRecognizer.
Therefore, with this platform-specific enabled, when a ListView contains a PanGestureRecognizer, both the ListView and the PanGestureRecognizer will receive the pan gesture and process it. However, with this platform-specific disabled, when a ListView contains a PanGestureRecognizer, the PanGestureRecognizer will capture the pan gesture and process it, and the ListView won't receive the pan gesture.