2

When I'm trying to design an interface in the designer on Visual Studio, a white border surrounds all of my windows.

When I set a background for the window, it will be contained within this white border, but when it runs, the background will expand into the white area from the designer. All major outer margins are set to 0.

This makes it impossible to design anything due to the IDE changing my layout when it compiles.

How do I remove this border?

[edit] Sorry, i forgot a sample of the code!, here's the top half the outer most xml minus the resources

<Window x:Class="BuildSaverAlpha4.Main_Window"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Main_Window" DataContext="{Binding RelativeSource={RelativeSource Self}}" ResizeMode="NoResize" AllowsTransparency="False" WindowStyle="None" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Activated="Window_Activated" Deactivated="Window_Deactivated" Closing="Window_Closing" BorderBrush="{x:Null}" Foreground="{x:Null}" WindowStartupLocation="CenterScreen" Height="562" Width="911" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="0">


<Grid Height="Auto" Width="Auto" Name="outerGrid" Margin="0,0,0,0">
    <Grid Height="41" HorizontalAlignment="Left" Margin="12,20,0,0" Name="grid1" VerticalAlignment="Top" Width="872" Background="#5DFF0000">
    </Grid>
    <Grid Background="#5DFF0000" Height="38" HorizontalAlignment="Left" Margin="12,72,0,0" Name="grid2" VerticalAlignment="Top" Width="872"></Grid>
    <TabControl Name="tabControl1" Margin="12,0,0,38" Background="{x:Null}" 

4

2 回答 2

1

是的,这似乎是 VS 2008 和 2010 的问题:

http://social.msdn.microsoft.com/Forums/en/wpf/thread/69cff97e-52d6-4130-8713-daf130580f54

如果您使用表达式,则选择 WindowStyle=None 将正确删除边框。

于 2012-06-22T10:40:19.790 回答
0

您的控件没有填充窗口。如果没有看到 xaml,很难发布代码来解决这个问题,但如果它是一个网格,那么请确保标记中没有固定的宽度或高度。其他控件要查看的其他内容是将Horizo​​ntalalignment 和verticalalignment 设置为“Stretch”。如果您可以发布此窗口的 XAML,那么我会尝试为您更正。

于 2012-05-16T06:38:21.107 回答