菜单和窗口之间的白色空间

时间:2017-02-08 22:32:55

标签: c# wpf xaml avalondock

在xaml窗口中使用menu控件,我在窗口边框和停靠面板之间有这个恼人的空白区域。

White space

菜单本身位于堆叠面板内:

   <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>

如何删除空白区域?我必须用某种东西来表达它吗?菜单应该在不同的容器中吗?

1 个答案:

答案 0 :(得分:2)

它只是Background定义为

的默认菜单样式
<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>

如果您不喜欢#FFFFFFFF底线,请定义不同的背景。