Forum Xamarin Xamarin.Forms

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

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" >
                <SwipeGestureRecognizer Direction="Left" Swiped="SwipeGestureRecognizer_Swiped">

                    <!--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 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>

                    <!--End Banner layout-->

                <!--End Banner Scroll-->


  • BillyLiuBillyLiu Member, Xamarin Team Xamurai


    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 ✭✭


    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.