0

I have this menu items in my WPF application. I noticed big spaces between and after the menu list.

This is how it looks like in the designer:

enter image description here

which seemed to be just fine except, there are too much space on both sides.

Then, when I run the application, it looks like this:

enter image description here

Now, there are spaces all around the menu item.

Here's my XAML code:

    <DockPanel>
        <Menu VerticalAlignment="Center" Width="Auto" Height="Auto" DockPanel.Dock="Top">
            <MenuItem Header="_File" Width="Auto" Height="Auto" FontFamily="Century Gothic" FontSize="12">
                <MenuItem Header="Exit" Width="Auto" Height="20">
                    <MenuItem.Icon>
                        <materialDesign:PackIcon Kind="ExitToApp"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
    </DockPanel>

How can I remove spaces around the menu item?

ThEpRoGrAmMiNgNoOb
  • 1,256
  • 3
  • 23
  • 46
  • You explicitly set the`Height="20"`, it can be a reason. Also try to use `MenuItem` without Icon or restrict its height and see what happens – Pavel Anikhouski Jul 30 '19 at 08:52
  • Possible duplicate of [System.Windows.Controls.MenuItem without icon area](https://stackoverflow.com/questions/5276826/system-windows-controls-menuitem-without-icon-area) – Rekshino Jul 30 '19 at 08:54
  • @PavelAnikhouski already tried doing that. The spaces went bigger. – ThEpRoGrAmMiNgNoOb Jul 30 '19 at 09:38
  • @Rekshino I'm totally fine with the icon area since I'm going to add icons later on. I'm more concerned about the top and bottom areas. – ThEpRoGrAmMiNgNoOb Jul 31 '19 at 02:22

0 Answers0