A ListView
in Xamarin.Forms has two events, which seem to be exactly the same: ItemTapped and ItemSelected
There isn't really any documentation about these, so what exactly is the difference?
A ListView
in Xamarin.Forms has two events, which seem to be exactly the same: ItemTapped and ItemSelected
There isn't really any documentation about these, so what exactly is the difference?
ItemSelected
is a state while ItemTapped
is a motion event. All views can be tapped and if I remember correctly all views can be selected (or at least activated there is a subtle difference), the two don't have to go together but they usually do.
For example you'd have an item's selected state toggled each time a tapped motion event has occurred. Once again just to make it more clear you can associate the changes of the selected state to whatever you need whether it's a motion event like tapping or long pressing or double tapping and so on or to some other event or logic.
Hope it helps and good luck!
ItemTapped
should occur every time you click on an item, while ItemSelected
every time the selected item has changed.
Basically
ItemTapped
, and only once ItemSelected
ItemTapped
two times, and ItemSelected
two timesOne major difference worth noting is how they work when the SelectionMode="None"
<ListView ... SelectionMode="None" />
When set to "None"...the ItemSelect
event will not fire and SelectedItem
property remains null
.
But
ItemTapped
events will continue to fire as expected.