如何知道android ViewCell.ContextActions show event



我怎么知道ContextActions是否出现在我的安卓设备上?

我想接收来自ListView中的长按项目的事件。

使用单击的事件

<ViewCell.ContextActions>
    <MenuItem
        Icon="chat.png"
        CommandParameter="{Binding .}"
        Text="Chat"
        Clicked="Handle_Chat_Tapped">
    </MenuItem>
</ViewCell.ContextActions>

在代码隐藏中处理事件,如下所示:

void Handle_Chat_Tapped(object sender, System.EventArgs e)
{
    var menuItem = sender as MenuItem;
    // whatever you want to do here
}

在 Xamarin 文档中阅读有关该主题的详细信息:https://developer.xamarin.com/guides/xamarin-forms/user-interface/listview/interactivity/#Context_Actions

最新更新