如何为ListView的ContextActions中的MenuItem添加可见性绑定。

huangapple go评论61阅读模式
英文:

How to add visibility binding for MenuItem of ContextActions of a ListView

问题

我尝试在选择任何ListView项时显示上下文操作菜单项,我已添加了三个菜单项。但我需要绑定这些菜单项的可见性。根据选择,特定的菜单项应该可见。是否有一种方法可以为ListView中的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?

答案1

得分: 2

由于ContextAction是一个MenuItem,所以这是不可能的。MenuItem不会暴露任何(可绑定的)IsVisible属性或类似属性。

一个不太正规的解决方法可以是在确定需要显示或隐藏的情况下添加/移除上下文操作。或者使用可用的IsEnabled属性。

英文:

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

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.

huangapple
  • 本文由 发表于 2020年1月4日 00:22:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/59581927.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定