I have a ListView with two events "ItemTapped" and "ItemSelected" when the user select the item an alert "You selected item" should be appear, and when a user tapped the item an alert "You tapped item" should be appear. but what happened is when the user select an item, first an alert of "You tapped item" is appear then alert of "You selected item" is appear why that happened ???
this is my Xaml file
<ListView x:Name="listView"
ItemTapped="Tapped"
ItemSelected="Select">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}" Detail="{Binding Status}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
code behinde
void Select(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
{
var contact = e.SelectedItem as Contact;
DisplayAlert("selected", "You selected item", "Ok");
// listView.SelectedItem = null;
}
void Tapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
{
var contact = e.Item as Contact;
DisplayAlert("tapped", "You tapped item", "Ok");
}
One workaround is possible to manage both events like, You Can call Listview ItemTapped Event on Double Tap on list item. & By Default Listview Single Tap can get ItemSelected Event.
Note: This is only Workaround to manage both on same time.