xamarin/Xamarin.Forms

Swiped Event of SwipeGestureRecognizer does not contain actual direction

Aberta

#4.473 aberto em 19 de nov. de 2018

 (9 comentários) (0 reação) (0 responsável)C# (1.926 forks)batch import
a/gestures 🖖e/3 :clock3:help wantedinactiveproposal-opent/bug :bug:t/enhancement ➕up-for-grabs

Métricas do repositório

Stars
 (5.644 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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

Guia do colaborador