0

Using the menu control in a xaml window, I have this annoying white space between the window border and the docking panel.

White space

The menu itself is inside a stackpanel:

   <Window x:Class="COZView.Shell" 
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sc="clr-namespace:COZView.StaticContent"
    xmlns:ve="clr-namespace:COZView.View_Edit"
    Title="COZView" Width="1024" Height="800" Icon="/COZView;component/Images/COZView.png" 
    Loaded="OnLoaded" IsVisibleChanged="isVisibleChanged" Closing="OnClosing">

<Grid x:Name="ShellRegion">
    <StackPanel Height="Auto" Orientation="Vertical">
         <Menu x:Name="menu">
           <!-- MENU ITEMS REMOVED -->
          </Menu>
           <Grid x:Name="DockingRegion" >
        <ad:DockingManager x:Name="DockManager">
            <ad:ResizingPanel>
                <ad:DocumentPane Margin="0,0,0,0">
                    <sc:StartPage Title="Home Page" VerticalContentAlignment="Stretch" 
                        onProjectOpenFail="StartPage_onProjectOpenFail" 
                        onProjectOpenSuccess="StartPage_onProjectOpenSuccess"
                        onProjectCreateSuccess="StartPage_onProjectCreateSuccess"
                        onProjectCreateFail="StartPage_onProjectCreateFail"/>
                </ad:DocumentPane>
                <ad:DockablePane ad:ResizingPanel.ResizeWidth="300" x:Name="ExplorerPane" FontSize="14" FontWeight="Bold">
                    <sc:AboutTab x:Name="about" Title="About" FontSize="14" FontWeight="Bold"/>
                    <sc:ProcessExplorer x:Name="pxProcessExplorer" Title="Process Explorer" FontSize="14"/>
                    <sc:DataExplorer x:Name="adDataExplorer" Title="Data Explorer" FontSize="14"/>
                    <!--<sc:UREPExplorer x:Name="adUREPExplorer" Title="UREP Custom Navigation" FontSize="14" Visibility="Hidden"/>-->
                </ad:DockablePane>
            </ad:ResizingPanel>
        </ad:DockingManager>
    </Grid>
    </StackPanel>
</Grid>

How do i remove the white space? Do I have to surrond it in something? Should the menu be in a different container?

Community
  • 1
  • 1
Jack Miller
  • 325
  • 1
  • 16
  • Try setting the margin to 0. Either the menu or the control below it has a menu or padding set that is causing the space. Also check to make sure that there is not a style somewhere that is causing the issue. – Nkosi Feb 08 '17 at 22:39
  • Thanks Nikos, applied a margin to all controls above and below, problem still persists. Checking styles now... – Jack Miller Feb 08 '17 at 22:51
  • Show more code. Are you using a designer? check what the value of the margins displayed in the designer property panel for the controls – Nkosi Feb 08 '17 at 22:53
  • It might help if you post XAML code for elements in the first row of your `DockingRegion` Grid – Pouya Abadi Feb 08 '17 at 22:53
  • Will upload the whole XAML file to a code sharing website, and share link, one minute – Jack Miller Feb 08 '17 at 22:54
  • @JackMiller, No just enough for us to get an idea of what controls may be causing the issue. Remember the these posts should provide a [mcve] that can be used to reproduce the problem. which would help provide better answers – Nkosi Feb 08 '17 at 22:55
  • 1
    @JackMiller, I would even suggest starting from scratch with a simple example and see if the problem still exists. From there you should get an idea as you add more control which one is the offending control – Nkosi Feb 08 '17 at 22:57
  • I made a simple wpf program with just a grid and menubar, problem wasn't there, I am working up to that point – Jack Miller Feb 08 '17 at 22:58
  • Just gonna bodge it for now, by adding a -3 margin to the top and bottom to remove white space – Jack Miller Feb 08 '17 at 23:06
  • Answered below, changing the background color from the original style – Jack Miller Feb 09 '17 at 17:41

1 Answers1

2

Its just the default menu style where Background is defined as

<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
    <LinearGradientBrush.GradientStops>
        <GradientStop Color="#FFF6F6F6" Offset="0.25" />
        <GradientStop Color="#FFEAE8E8" Offset="0.25" />
        <GradientStop Color="#FFDCD9D9" Offset="0.8" />
        <GradientStop Color="#FFFFFFFF" Offset="1" />
    </LinearGradientBrush.GradientStops>
</LinearGradientBrush>

Define a different background if you dont like the #FFFFFFFF bottom line.

grek40
  • 13,113
  • 1
  • 24
  • 50