WPF - How to style the menu control to remove the left margin?

后端 未结 9 1530
余生分开走
余生分开走 2021-02-04 08:41

I have added a default menu control to my user control. I need to style the menu to remove the left margin containing the space for the icon or checkbox. How can I do this?

9条回答
  •  花落未央
    2021-02-04 09:16

    Two options here:

    1. Short, simple and straight forward. Set ItemsPanelTemplate for MenuItem or ContextMenu, depending what kind of menu you are using (see details).

    2. Radical. Rewrite Menu style from scratch. There are two ready to use styles:

      • XAML-style of Menu from MahApps.Metro (ordinary Menu and ContextMenu)
      • Jeff Wilcox's style which inspired the previous one from MahApps (link)

提交回复
热议问题