Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

xamarin forms scroll-view is not working with carousel view

$
0
0

Hi Everyone, I am stuck in this, I have added a carousel view inside a scroll-view and now scrolling is not working on it, on iOS please give me any suggestion or workaround.

I have tried to add a boxview over my carousel control with same height and I added swipe gesture on it and on left-right swipe I have disabled the boxview visibility and enabled it for up-down and it works fine (scroll and carousel) but still it stuck for first time and starts working from second time. Any suggestion will be really helpful.

Xaml :

<Grid>
    <Grid.GestureRecognizers>
            <SwipeGestureRecognizer Direction="Up" Swiped="OnSwiped" />
                 <SwipeGestureRecognizer Direction="Down" Swiped="OnSwiped"/>
                 <SwipeGestureRecognizer Direction="Left" Swiped="OnSwiped"/>
                 <SwipeGestureRecognizer Direction="Right" Swiped="OnSwiped"/>
             </Grid.GestureRecognizers>
             <cards:CarouselView ItemsSource="{Binding CampaignData.products}"  SelectedIndex="0"  Margin="-20,0,-20,0">
                 <cards:CarouselView.ItemTemplate>
                     <DataTemplate>
                         <ContentView>
                             <Frame VerticalOptions="Center" HorizontalOptions="FillAndExpand"
                                    HeightRequest="325" Padding="0" HasShadow="false" IsClippedToBounds="true"
                                    CornerRadius="0" BackgroundColor="#FBFBFB">
                                 <FFImgLoad:CachedImage Source="{Binding product_images}" Aspect="Fill"/>
                             </Frame>
                         </ContentView>
                     </DataTemplate>
                 </cards:CarouselView.ItemTemplate>
                 <controls:IndicatorsControl />
             </cards:CarouselView>
             <BoxView x:Name="scrollcheck" IsVisible="False" BackgroundColor="Transparent" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" HeightRequest="325" Margin="-20,0,-20,0"/>
</Grid>

Code behind :

    void OnSwiped(object sender, SwipedEventArgs e)
    {
        switch (e.Direction)
        {
            case SwipeDirection.Up:
                scrollcheck.IsVisible = true;
                break;
            case SwipeDirection.Down:
                scrollcheck.IsVisible = true;
                break;
            case SwipeDirection.Left:
                scrollcheck.IsVisible = false;
                break;
            case SwipeDirection.Right:
                scrollcheck.IsVisible = false;
                break;
        }
    }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>