如何为wpf中的上下文菜单中放置的菜单项的子菜单项加载样式? [英] How to load style for sub menu item of a menu item which is placed inside a context menu in wpf?
问题描述
如何为wpf中的上下文菜单中的菜单项的子菜单项加载样式?
或告诉我这个场景的解决方案 - :点击按钮(不正确)单击,只需单击鼠标左键)当鼠标悬停在主菜单项上时,菜单应显示,并显示子菜单。(重要所有菜单项应在运行时/动态加载
实际上我用这种方式做了它的工作,1。我创建了一个按钮,在它的点击事件中我打开了一个上下文菜单.2。上下文菜单中有带标题及其项目的菜单项.3。我应用了样式对于上下文菜单。输出:显示按钮单击时显示正确样式的菜单,并显示鼠标在子菜单上。但问题是样式不适用于子菜单。我尝试将样式分配给该菜单项,但是没用...
请给我一些解决方案.....
提前致谢
How to load style for sub menu item of a menu item which is placed inside a context menu in wpf?
or tell me a solution to this scenario - : In a button click(not right click, only left click) a menu should appear with sub menus displayed when mouse over the main menu items.(Important All menu items should be loaded at run-time/dynamically
Actually i did it in this way and its working, 1. I created a button and in its click event i opened a context menu. 2. The context menu has menu-item with header and its item. 3. I applied style for context menu. output: this shows menu with correct style in button click and on mouse over sub menu is displayed. But the problem is the style is not applied to sub menu. i tried of assigning style to that menu item also, but its useless...
Pls suggests me some solutions.....
Thanks in advance
推荐答案
找到答案 - ItemContainerStyle
我们必须设置menuitem的itemcontainerstyle属性。
感谢您阅读任何方式
Found answer - "ItemContainerStyle"
We have to set itemcontainerstyle property of a menuitem.
Thanks for reading Any way
这篇关于如何为wpf中的上下文菜单中放置的菜单项的子菜单项加载样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!