How do I know if ContextActions
appears on my Android device?
I would like to receive events that come from a Long Click item in a ListView
.
Use the Clicked Event:
<ViewCell.ContextActions>
<MenuItem
Icon="chat.png"
CommandParameter="{Binding .}"
Text="Chat"
Clicked="Handle_Chat_Tapped">
</MenuItem>
</ViewCell.ContextActions>
Handle the event in code behind like this:
void Handle_Chat_Tapped(object sender, System.EventArgs e)
{
var menuItem = sender as MenuItem;
// whatever you want to do here
}
Read more about the topic in the Xamarin documentation: https://developer.xamarin.com/guides/xamarin-forms/user-interface/listview/interactivity/#Context_Actions