我创建了一个collectionview,并在此控件内使用TapGestureRecognizer创建了一个网格,但是在iOS上,该命令未触发...在Android上运行正常。第二个问题是,此网格内的按钮也不起作用。(在android上,一切正常。这是控件:
<CollectionView ItemsSource="{Binding Claims}"
SelectionMode="None"
SelectedItem="{Binding SelectedClaim}">
<CollectionView.ItemsLayout>
<LinearItemsLayout ItemSpacing="5"
Orientation="Vertical"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame Padding="0"
InputTransparent="True"
Margin="0">
<Frame Margin="10,5"
Padding="5"
InputTransparent="True"
CornerRadius="10"
HeightRequest="160"
HasShadow="True"
BorderColor="Gray"
Visual="Default">
<Grid VerticalOptions="Center">
<d:Grid.BindingContext>
<models:Claim/>
</d:Grid.BindingContext>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:ClaimsOverViewViewModel}}, Path=ViewCardCommand}"
CommandParameter="{Binding}"/>
</Grid.GestureRecognizers>
<Grid.RowDefinitions>
<RowDefinition Height="75"/>
<RowDefinition Height="4"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="0"
InputTransparent="True"
Grid.Column="0"
Grid.ColumnSpan="2">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:ClaimsOverViewViewModel}}, Path=ViewCardCommand}"
CommandParameter="{Binding}"/>
</StackLayout.GestureRecognizers>
<Label Text="Entwurf"
TextColor="Red"
FontSize="Medium"
Margin="0,-20,0,0"
IsVisible="{Binding IsNotValid}"
HorizontalTextAlignment="Start"
VerticalTextAlignment="Start"/>
<Label Text="{Binding PolicyNumber}"
FontAttributes="Bold"
FontSize="Large"
VerticalTextAlignment="Start"
HorizontalTextAlignment="Start"/>
<Label Text="{Binding CustomerName}"
FontSize="Small"
VerticalTextAlignment="End"
HorizontalTextAlignment="Start"/>
</StackLayout>
<BoxView Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
BackgroundColor="Gray"
InputTransparent="True"
HeightRequest="2"
HorizontalOptions="Fill"/>
<Label Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Text="{Binding Date}"
VerticalTextAlignment="Start"
VerticalOptions="Fill"
HorizontalOptions="Fill"/>
<StackLayout Grid.Column="1"
InputTransparent="True">
<Button Text="Löschen"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:ClaimsOverViewViewModel}}, Path=DeleteCommand}"
CommandParameter="{Binding}"
BorderColor="Red"
CornerRadius="10"
VerticalOptions="Center"
BorderWidth="3"
BackgroundColor="White"
WidthRequest="80"
HeightRequest="30"
Padding="0"
Margin="0,-10,0,10"
HorizontalOptions="End"/>
<Button Text="Senden"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:ClaimsOverViewViewModel}}, Path=SendClaimCommand}"
CommandParameter="{Binding}"
BorderColor="Green"
CornerRadius="10"
VerticalOptions="Center"
BorderWidth="3"
BackgroundColor="White"
WidthRequest="80"
HeightRequest="30"
Padding="0"
Margin="0"
HorizontalOptions="End"/>
</StackLayout>
</Grid>
</Frame>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
我已经在不同的地方(堆栈布局,网格,框架)尝试了轻敲识别器,并且还尝试了IpnutTransparent-Property ...
<TapGestureRecognizer Tapped="{Binding Source=RelativeSource AncestorType={x:Type viewmodels:ClaimsOverViewViewModel}},Path=ViewCardCommand}" />