【问题标题】:How to know android ViewCell.ContextActions show event?如何知道 android ViewCell.ContextActions 显示事件?
【发布时间】:2018-01-18 04:37:36
【问题描述】:

我如何知道ContextActions 是否出现在我的 Android 设备上?

我想接收来自ListView 中的Long Click 项目的事件。

【问题讨论】:

    标签: xamarin.forms menuitem long-click


    【解决方案1】:

    使用 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

    【讨论】:

    • 感谢您的宝贵时间。丹尼斯 :) 谢谢你的帮助。但我想要的是,如果选择了 ListViewItem 的 ContextActions,我希望另一个 ListViewItem 的 ContextActions 不处于活动状态。所以我想在选择上下耳方面时禁用ListView的单击列表查看。 span>
    • 知道了。您应该编辑您的问题,因为现在这与我回答的原始问题完全不同,因此您更容易收到答案
    • 好的,我提出新问题
    猜你喜欢
    • 2018-04-18
    • 1970-01-01
    • 2017-11-08
    • 1970-01-01
    • 2018-07-02
    • 2019-05-05
    • 1970-01-01
    • 1970-01-01
    • 2016-01-23
    相关资源
    最近更新 更多