Benjamin

Benjamin

  • NA
  • 1
  • 4.4k

ContextMenu Separator height

Sep 14 2010 5:57 PM
Can anyone explain how to change the ContextMenu Separator height? 

I am using the following code but the separator line just disappears when run as soon as Height is lowered to 10 (MaxHeight also has the same effect).  Padding has no effect and Margin helps but still does not remove enough top and bottom "padding".

ContextMenu itemContextMenu = new ContextMenu();

MenuItem cut = new MenuItem();
cut.Header = "Cut";
itemContextMenu.Items.Add( cut );

Separator s = new Separator();
s.Padding = new Thickness( 0 ); // no effect
s.Margin = new Thickness( 0 ); // removes some top and bottom "padding" but not enough
s.Height = 10; // when height is set to 20 the separator line is
// displayed with too much padding above and below the line
itemContextMenu.Items.Add( s );

MenuItem paste = new MenuItem();
paste.Header = "Paste";
itemContextMenu.Items.Add( cut );

regards,
Benjamin

Answers (1)