xamarin/Xamarin.Forms

Swiped Event of SwipeGestureRecognizer does not contain actual direction

Aperta

#4473 aperta il 19 nov 2018

 (9 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/gestures 🖖e/3 :clock3:help wantedinactiveproposal-opent/bug :bug:t/enhancement ➕up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

The Swiped event of SwipeGestureRecognizer does not contain actual direction

Steps to Reproduce

Create a new page and in Xaml:

<!-- Swipe Gesture -->
<Label Text="Swipe Gesture" class="featureHeader" Margin="0,20,0,10"/>
<BoxView BackgroundColor="Black" Margin="0,0,0,10" HeightRequest="1"/>
<Label Text="Swipe right-to-left or left-to-right on the green box below." Margin="0,10"/>
<BoxView BackgroundColor="Lime" WidthRequest="300" HeightRequest="300">
    <BoxView.GestureRecognizers>
        <SwipeGestureRecognizer
            Direction="Right, Left"
            Swiped="SwipeGestureRecognizer_Swiped" />
    </BoxView.GestureRecognizers>
</BoxView>

In code:

private async void SwipeGestureRecognizer_Swiped(object sender, SwipedEventArgs e)
{
    await DisplayAlert("Swiper No Swiping!", $"Yay! You swiped to the {e.Direction}!", "Close");
}

Run the app and swipe either way,

code sample taken from TheLittleThingsPlayground

Actual Behavior

image

Expected Behavior

The message should tell the actual direction of the swipe, either Right or Left, I didn't swipe in both directions at the same time

Basic Information

Testing on:

  • Xamarin.Forms: 3.4
  • IDE: 15.9
    • iOS: 12.1

Guida contributor