简体   繁体   English

WPF设计器中窗口上方出现白色边框

[英]White border appearing above window in WPF designer

When using the designer in Visual Studio, a white bar appears at the top. 在Visual Studio中使用设计器时,顶部会出现一个白色的栏。 I am unable to put any content in this bar as anything that goes near it goes underneath it. 我无法在此栏中放置任何内容,因为靠近它的所有内容都在其下方。

http://i.imgur.com/tqp59.png

This causes a black bar to appear where I can't place content and it is making it impossible to design the window, because all of the locations change from designer to run-time. 这会导致一个黑条出现在我无法放置内容的位置,并且使得无法设计窗口,因为所有位置都从设计者到运行时改变。

The white bar at the top is to allow room for the Window Bar. 顶部的白色栏为窗口栏留出空间。 You can change the black gap at the top of the application by changing the margin of the grid that surrounds all the controls: 您可以通过更改包围所有控件的网格的边距来更改应用程序顶部的黑色间隙:

<Grid Margin="0,-10,0,0">

</Grid>

Where Margin="left,up,right,down" so Margin="0,-10,0,0" will move the whole grid margin up 10 more pixels, so you can add anything you want into that extra space up the top. 其中Margin =“ left,up,right,down”,因此Margin =“ 0,-10,0,0”将使整个网格边距再向上移动10个像素,因此您可以将所需的任何内容添加到顶部的额外空间中。 This should also get rid of your black bar issue. 这也应该摆脱您的黑条问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM