C# Xamarin表单:在ContentView中添加多个点击手势

C# Xamarin表单:在ContentView中添加多个点击手势,c#,xamarin,xamarin.forms,C#,Xamarin,Xamarin.forms,我建立了一个共享的标题,它在我的内容页面上共享。此共享标头是一个ContentView,带有几个标签。我已经为其中4个标签添加了标签。现在,当我运行该应用程序时,只有我声明的前3个标签将触发TapPassive事件。我通过在Xaml中重新排列标签来检查这一点。 平台:iOS Xamarin表单版本:2.2.0.45 这是Xaml <StackLayout> <Grid> <Grid.ColumnDefinitions> <Colu

我建立了一个共享的标题,它在我的内容页面上共享。此共享标头是一个ContentView,带有几个标签。我已经为其中4个标签添加了标签。现在,当我运行该应用程序时,只有我声明的前3个标签将触发TapPassive事件。我通过在Xaml中重新排列标签来检查这一点。 平台:iOS Xamarin表单版本:2.2.0.45

这是Xaml

<StackLayout>
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="45*" />
      <ColumnDefinition Width="50*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="70"/>
    </Grid.RowDefinitions>
    <Image Grid.Column="0" Grid.Row="0" Source="ss" Aspect="AspectFit" VerticalOptions="CenterAndExpand"/>
    <StackLayout Grid.Column="1" Grid.Row="0">
      <StackLayout Orientation="Horizontal">
        <Label Text="For :" TextColor="Black" HorizontalOptions="StartAndExpand"></Label>
        <Label x:Name="lblUser" Text="Chris Shepard" TextColor="#3170A6" HorizontalOptions="EndAndExpand" />
      </StackLayout>
      <StackLayout Orientation="Horizontal">
        <Label Text="Active Quotes:" TextColor="Black" HorizontalOptions="StartAndExpand"></Label>
        <Label x:Name="lblQuotes" Text="1" TextColor="#3170A6" HorizontalOptions="EndAndExpand" />
      </StackLayout>          
      <StackLayout Orientation="Horizontal">
        <Label Text="Active Con Notes :" TextColor="Black" ></Label>
        <Label x:Name="lblConNotes" Text="2" TextColor="#3170A6" HorizontalOptions="EndAndExpand" />
      </StackLayout>
      <StackLayout Orientation="Horizontal">
        <Label Text="Balance:" TextColor="Black" HorizontalOptions="StartAndExpand">        
        </Label>
        <Label x:Name="lblPayment" Text="$ 234.56" TextColor="#3170A6" HorizontalOptions="EndAndExpand" >
        </Label>
      </StackLayout>

    </StackLayout>
  </Grid>
  <StackLayout>
    <Button/>
    <BoxView HeightRequest="1" WidthRequest="1" BackgroundColor="Black"/>
  </StackLayout>
</StackLayout>
有人能告诉我我做错了什么吗。或者Xamarin在一种形式中不支持3个以上的TapPictures吗?

您的
是导致问题的因素,我将背景更改为红色以在预览器中查看:

<Button BackgroundColor="Red"/>

在Android上,这很好:

但在iOS上,由于不受约束,它覆盖了您最后的
网格。行
,因此点击将指向按钮而不是标签:


您将需要约束其高度或包含它的布局,可能会给两个顶层
堆栈布局
一个星号高度(即
*9
*1

哪个
Xamarin.Forms
版本?哪个平台?是iOS和无约束按钮,看我的答案。你是明星。谢谢:)
<Button BackgroundColor="Red"/>