如何为ListView的ContextActions的MenuItem添加可见性绑定 [英] How to add visibility binding for MenuItem of ContextActions of a ListView

查看:147
本文介绍了如何为ListView的ContextActions的MenuItem添加可见性绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在选择任何列表视图项目时显示上下文操作菜单项,在那里我添加了三个菜单项.但是我需要绑定这些菜单项的可见性.根据选择,特定菜单项应可见.有什么方法可以为列表视图中的contextActions菜单项添加绑定?

I am trying display context actions menu items while selecting any listview item, there I have added three menu items. But I need to bind the visibility for those Menu Items. Depending on selection the specific menuitem should be visible. Is there any way to add binding for the contextActions menuitems in a listview?

推荐答案

由于ContextAction

Since a ContextAction is a MenuItem this is not possible. The MenuItem does not expose any (bindable) IsVisible property or alike.

一个变通的解决方法是,每当您确定需要显示或隐藏哪些内容时,都可以添加/删除上下文操作.或使用可用的IsEnabled属性.

A hacky workaround could be to add/remove context actions whenever you determine what needs to be shown or hidden. Or use the IsEnabled property that is available.

这篇关于如何为ListView的ContextActions的MenuItem添加可见性绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆