Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
540 views
in Technique[技术] by (71.8m points)

xamarin.forms - GridView blocking Image TapGestureRecognizer

I cant get the image tap to move to the next page with the gridview set up. When I have stackview I have not problem. I have also tried to check InputTransparent with no luck. I am using Xamarin.Forms and testing with android. Help?

    <ContentPage.Content>
        <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <Image Grid.ColumnSpan="2" Source="{local:ImageResource HemaSwordFiore.Images.BGAxe.LongTail.jpg} " 
                           VerticalOptions="Center"  
                           HorizontalOptions="Center">
                        <Image.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_1" 
                                  NumberOfTapsRequired="1"/>
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.ColumnSpan="2" Text="Axe in Armor" Style="{StaticResource SubHeader}"
                           HorizontalOptions="CenterAndExpand"/>
                    <!-- missing titles and imgaes -->

                    <Image Grid.Row="1" Source="{local:ImageResource HemaSwordFiore.Images.BGSpear.BoarsTusk.png} " 
                           VerticalOptions="Center"  
                           HorizontalOptions="Center">
                        <Image.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped_2" 
                                  NumberOfTapsRequired="1"/>
                        </Image.GestureRecognizers>
                    </Image>

                    <Label Grid.Row="1" Text="Spear" Style="{StaticResource SubHeader}"
                           HorizontalOptions="CenterAndExpand" InputTransparent="True" />
 
                </Grid>
    </ContentPage.Content>
</ContentPage>

And here is the code behind

        private async void TapGestureRecognizer_Tapped_1(object sender, EventArgs e)
         {
            await Navigation.PushAsync(new SAAxe1());
         }
        private async void TapGestureRecognizer_Tapped_2(object sender, EventArgs e)
         {
             await Navigation.PushAsync(new SASpear1());
         }
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...