防止 WPF 中菜单控件的菜单关闭
当我们单击其区域之外时,我试图阻止 Wpf 中菜单控件的菜单关闭。
我的目标是,例如,我们是否在窗口顶部有一个菜单控件。然后我们打开任何菜单,如果单击窗口中的某个位置,菜单就会关闭。这就是我想要防止发生的事情。
我想要的是只有当单击菜单项之一或其标题时,菜单才能关闭...
有人知道如何在 Wpf 中实现这一点吗?
提前致谢!
I am trying to prevent the closing of the Menus of a Menu control in Wpf when we click out of his area.
My objective is if we for example have a Menu control in the top of the window. We then open any of the menus, and if we click somewhere in the window, the Menu closes. That is what I am wanting to prevent from happening.
What I want is only when the click happens on one of the Menu items, or in its header then the Menu can close...
Anyone know how to achieve this in Wpf?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一个类似问题,这里是发布的解决方案:
There is a similar question available, here is the solution posted:
只需设置
StaysOpen
属性为 trueJust set the
StaysOpen
property to true