WPF: How to remove menu popup border

2019-09-19 03:16发布

问题:

I want to remove menu's popup border. Not the menu items's border as explained in this post.

This is a pic of my menu popup and I want to remove the white border the popup has.

I am using mahapps library for my main windows with basedark theme. Also please be patient with me, as I am new to WPF and XAML.

Here are all the things I have tried-

  1. Overwrote the border thickness and border brush of all the "menu items" with my custom style. This did not help as the border which I am interested is not tied to menuItems.
  2. Overwrote the border thickness and border brush property of the "menu" element. This just changes the menu element when the mouse is not over it. Hope that made sense.

I need the element/control trigger/content-presenter the menu element possesses to disappear the menu popup border. Hope someone can help me in this regard.

回答1:

My question was similar to the one asked here - Removing thin border around the menuitems

I apologize for duplicating the question. I was of the thinking the property was tied to "Menu" but the property is still tied to "MenuItem". Changing the "Padding" and "BorderThickness" to 0 of the popup's border solved my issue.