SwipeGestureRecognizer is not working in nested stackLayout --> Xamarin.Form version 3.3.0.967583

I tried applying GestureRecognizer to Outer stack layout / to ScrollView / to inner stack layout / to image also, but its not working

                <!--Banner Scroll-->
                <ScrollView  Orientation="Horizontal" x:Name="bannerScroll" IsEnabled="true" 
                             InputTransparent="False" >
            <ScrollView.GestureRecognizers>
                <SwipeGestureRecognizer Direction="Left" Swiped="SwipeGestureRecognizer_Swiped">

                </SwipeGestureRecognizer>
            </ScrollView.GestureRecognizers>
                    <!--Banner layout-->
                    <StackLayout Padding="0,0,0,0" x:Name="SlidingStack" Orientation="Horizontal" 
                            VerticalOptions="CenterAndExpand" InputTransparent="False">

                        <Image x:Name="image" Source="download1.jpg" 
                            WidthRequest="255" Aspect="Fill" InputTransparent="False" >
                        </Image>
                        <Image x:Name="image1" Source="download2.jpg" 
                            WidthRequest="255" Aspect="Fill" InputTransparent="False"></Image>
                        <Image x:Name="image2" Source="download3.jpg" 
                            WidthRequest="255" Aspect="Fill" InputTransparent="False"></Image>

                    </StackLayout>
                    <!--End Banner layout-->

                </ScrollView>
                <!--End Banner Scroll-->
</StackLayout>

Answers

  • BillyLiuBillyLiu Member, Xamarin Team Xamurai

    @parvezs7

    I think you could use ScrollView Scrolled event instead of using GestureRecognizers.
    You could get ScrollX value from ScrolledEventArgs to judge it scroll to right or left.

  • parvezs7parvezs7 Member ✭✭

    @BillyLiu

    Its an alternative and not even accurate. I have to write code for first checking whether it is swiped left or right , which is complicated. Using gesture recognizer is easier and more accurate but Why not gesture is working? do i am using it in wrong way? atleast it should be worked with stacklayout.

Sign In or Register to comment.