如何禁用 WPF 中的上下文菜单?

发布于 2024-09-10 17:45:39 字数 75 浏览 2 评论 0原文

我在 wpf 上下文中有两个菜单项, 我用命令绑定它们,当这两个项目都不可用时,我的意思是当两个命令都无法执行时,如何隐藏上下文菜单?

I have two Menu items in a wpf context,
I bind them with command, how do I hide context menu when both items are not available, I mean when both commands cannot be executed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

比忠 2024-09-17 17:45:39

为 ContextMenuOpening 事件添加事件处理程序。将 ContextMenuEventArgs 对象中的 Handled 属性设置为 true,上下文菜单将不会打开。

Add an event handler for ContextMenuOpening event. Set Handled property in ContextMenuEventArgs object to true and the context menu will not open.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文