question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tapgesturerecognizer of stack layout in data tamplet not working xamarin forms iOS inside CarouselView

See original GitHub issue

I’m trying to use tapgesturerecognizer in stack layout inside the data templet but its not working in iOS working fine in Android.

 <cards:CarouselView x:Name="CarouselView"  HeightRequest="209" Grid.Row="0"  
                                                       VerticalOptions="FillAndExpand" 
                                                        HorizontalOptions="FillAndExpand"
                                                        ItemAppearing="Handle_ItemAppearing"
                                        ItemsSource="{Binding Photos}"
                                       >
                                        <cards:CarouselView.ItemTemplate>
                                            <DataTemplate>
                                                <ContentView>
                                                     <Grid BackgroundColor="{StaticResource lightBlueGrey}"  HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="*" />
                                                        </Grid.RowDefinitions>
                                                        <Grid Grid.Row="0"  BackgroundColor="{StaticResource lightBlueGrey}" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="*" />
                                                                <ColumnDefinition Width="*" />
                                                                <ColumnDefinition Width="*" />
                                                            </Grid.ColumnDefinitions>
                                                            <StackLayout Grid.Column="0"  Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="Center">
                                                                <ffSvg:SvgCachedImage HeightRequest="53" WidthRequest="53" Source="swap_contact.svg" />
                                                                <Label Margin="14,0" Text="{Binding ContactString}" HorizontalTextAlignment="Center" FontFamily="{StaticResource NormalFont}" FontSize="13" FontAttributes="None" TextColor="{StaticResource BlueGrey}" />
                                                                <StackLayout.GestureRecognizers>
                                                                    <TapGestureRecognizer Tapped="ContactTapped" NumberOfTapsRequired="1"  />
                                                                </StackLayout.GestureRecognizers>
                                                            </StackLayout>
                                                            <StackLayout Grid.Column="1" Opacity="{Binding Opacity}" Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="Center">
                                                                <ffSvg:SvgCachedImage x:Name="FavIcon" HeightRequest="53" WidthRequest="53" Source="{Binding FavIcon}" />
                                                                <Label  Margin="14,0" x:Name="FavLabel" Text="{Binding FavouriteString}"  HorizontalTextAlignment="Center" FontFamily="{StaticResource NormalFont}" FontSize="13" FontAttributes="None" TextColor="{StaticResource BlueGrey}" />
                                                                <StackLayout.GestureRecognizers>
                                                                    <TapGestureRecognizer Tapped="FavoritesTapped" NumberOfTapsRequired="1" />
                                                                </StackLayout.GestureRecognizers>
                                                            </StackLayout>
                                                            <StackLayout Grid.Column="2" Opacity="{Binding Opacity}" Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="Center">
                                                                <ffSvg:SvgCachedImage HeightRequest="53" WidthRequest="53" Source="swap_decline.svg" />
                                                                <Label  Margin="21,0" Text="{i18n:Translate MatchesStringDelete}" HorizontalTextAlignment="Center" FontFamily="{StaticResource NormalFont}" FontSize="13" FontAttributes="None" TextColor="{StaticResource BlueGrey}" />
                                                                <StackLayout.GestureRecognizers>
                                                                    <TapGestureRecognizer Tapped="DeleteTapped" NumberOfTapsRequired="1" />
                                                                </StackLayout.GestureRecognizers>
                                                            </StackLayout>
                                                        </Grid>
                                                        <ffSvg:SvgCachedImage Grid.Row="0" HeightRequest="209" Aspect="AspectFill" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Source="{Binding Photo}" />
                                                           

                                                    </Grid>
                                                </ContentView>
                                            </DataTemplate>
                                        </cards:CarouselView.ItemTemplate>

                                      
                                    </cards:CarouselView>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
emipasatcommented, Feb 18, 2019

Meanwhile, I got it solved. It was IsPanInteractionEnabled which should be True for iOS and False for Android. In my case was False, tested first on Android.

1reaction
aman720guptacommented, Feb 18, 2019

@AndreiMisiukevich will check and let you know.

Thanks a lot 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TapGestureRecognizer doesn't work when added to ...
On android it doesn't work. The only workaround i have found is adding de tapgesture inside the template for each item in the...
Read more >
Xamarin Carousel GestureRecognizers Not Working
I want to implement a Carousel view swipe gesture recognizer left or right Swipes. But ONLY tapped event can be recognized ,gesture events ......
Read more >
Trying to create a control template that inherits parent class ...
I am trying to make a template for a form on my Xamarin. ... Here is the problem, I have TapGestureRecognizers and several...
Read more >
ImageButton Command not executed in Xamarin Form ...
hi, im trying to implement CaroulselView and add command to imagebutton in template. <CarouselView ItemsSource="{Binding weblinks}" ...
Read more >
TapGestureRecognizer not working in CollectionView
Dear Community! I want to have a TapGestureRecognizer on my Posts on my Accountpage. Therefore i added the GEstureRecognizer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found