xamarin/Xamarin.Forms

Swiped Event of SwipeGestureRecognizer does not contain actual direction

开放

#4,473 创建于 2018年11月19日

 (9 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
a/gestures 🖖e/3 :clock3:help wantedinactiveproposal-opent/bug :bug:t/enhancement ➕up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南