mrxten/XamEffects

[Bug] TapCommand is different in Xamarin.Android than in Xamarin.iOS

SymxnCreator opened this issue · 0 comments

Hi there,

I have the following scenario: (Simplified for demonstration)

<ListView ItemsSource="{Binding Users, Mode=OneWay}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <Grid Padding="12"
                      ColumnSpacing="16">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Column="0"
                           Text="Click me!"
                           FontSize="16"
                           FontAttributes="Bold"
                           TextColor="Black"
                           VerticalOptions="Center"></Label>

                    <Grid Grid.Column="1"
                          xe:TouchEffect.Color="{StaticResource TouchEffectColor}"
                          xe:Commands.Tap="{Binding BindingContext.OpenUserOptionsCommand, Source={x:Reference thisMemberCollectionPage}, Mode=OneWay}"
                          xe:Commands.TapParameter="{Binding ., Mode=OneWay}"></Grid>
                </Grid>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>

    <ListView.Behaviors>
        <behaviors:EventToCommandBehavior EventName="ItemTapped"
                                          Command="{Binding UserTappedCommand}"
                                          EventArgsPropertyPath="Item"></behaviors:EventToCommandBehavior>
    </ListView.Behaviors>
</ListView>

When clicking on the inner grid in the ViewCell, Xamarin.Android only triggers the TapCommand of the grid by XamEffects.

In Xamarin.iOS, however, the TapCommand and the ItemTapped event of the ListView are triggered.
This is stupid because I use both events and then both are triggered at the same time.
It is also not that great that something different happens on both platforms.

Can you prevent ItemTapped from firing in iOS?