问题描述
我正在尝试在选择任何列表视图项目时显示上下文操作菜单项,在那里我添加了三个菜单项.但是我需要绑定这些菜单项的可见性.根据选择,特定菜单项应可见.有什么方法可以为列表视图中的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
是 MenuItem
这是不可能的. MenuItem
不公开任何(可绑定)IsVisible
属性或类似属性.
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添加可见性绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!