Hello everyone,
I created a Listview with an ItemTapped event, everything was working fine until I included ContextActions,
apparently, something in the ContextActions makes the ItemTapped not to be activated, the curious thing is that this only happens in the Android version.
This is the code:
<ListView x:Name="AlertList"
SeparatorColor="#66acc2"
HasUnevenRows="True"
Grid.Row="1"
BackgroundColor="#333"
ItemTapped="OnSelectedAlert">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell >
<ViewCell.ContextActions>
<MenuItem Clicked="OnShareAlert" Text="Share" CommandParameter="{Binding .}" Icon="share.png"/>
<MenuItem Clicked="OnNotDisplay" Text="Don't show this" CommandParameter="{Binding .}" Icon="eyeoff.png" IsDestructive="True" />
</ViewCell.ContextActions>
<Grid ColumnSpacing="2" BackgroundColor="#333">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="FillAndExpand">
<Label Text="{Binding Position}" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" FontSize="Large" FontAttributes="Bold" TextColor="#e55962" Margin="5"/>
</StackLayout>
<StackLayout Grid.Row="0" Grid.Column="1" Padding="5" Orientation="Vertical" VerticalOptions="FillAndExpand">
<Label FontSize="Medium" TextColor="White" Text="{Binding Title}" FontAttributes="Bold" VerticalOptions="CenterAndExpand"/>
</StackLayout>
<StackLayout Grid.Row="0" Grid.Column="2" Orientation="Horizontal" VerticalOptions="FillAndExpand">
<Image x:Name="DownloadIcon" Source="download.png" HorizontalOptions="Center" VerticalOptions="Center" Margin="5"/>
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
I have tried to use ItemSelected but it has the same result.
Xamarin specifications:
- Xamarin.Forms v2.4.0.269-pre2
- Xamarin.Android.Support Libraries v25.4.0.2
Any idea?
Thanks in advance.