【发布时间】:2018-01-18 04:37:36
【问题描述】:
我如何知道ContextActions 是否出现在我的 Android 设备上?
我想接收来自ListView 中的Long Click 项目的事件。
【问题讨论】:
标签: xamarin.forms menuitem long-click
我如何知道ContextActions 是否出现在我的 Android 设备上?
我想接收来自ListView 中的Long Click 项目的事件。
【问题讨论】:
标签: xamarin.forms menuitem long-click
使用 Clicked 事件:
<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
【讨论】: