【发布时间】:2017-02-09 19:22:43
【问题描述】:
在 xaml 窗口中使用 menu 控件,我在窗口边框和停靠面板之间有这个烦人的空白。
菜单本身位于堆栈面板内:
<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>
如何删除空白?我必须用某种东西包围它吗?菜单应该在不同的容器中吗?
【问题讨论】:
-
尝试将边距设置为 0。菜单或其下方的控件具有导致空间的菜单或填充集。还要检查以确保某处没有导致问题的样式。
-
感谢 Nikos,对上下所有控件应用了边距,问题仍然存在。正在检查样式...
-
显示更多代码。你在用设计师吗?检查控件的设计器属性面板中显示的边距值是什么
-
如果您在
DockingRegionGrid 的第一行中发布元素的 XAML 代码,这可能会有所帮助 -
@JackMiller,我什至建议从一个简单的例子从头开始,看看问题是否仍然存在。从那里你应该知道当你添加更多控件时,哪个是有问题的控件
标签: c# wpf xaml avalondock