我剛開始使用WPF,我試圖設置一個四行高150的網格。這將佔用我爲高度設置的800個像素中的600個像素。然後,我將頂部保證金設置爲30,我的底部保證金設置爲170,爲底部的控制提供了一些空間。WPF頁邊距不加起來
在設計視圖中一切看起來都很棒,但是當我運行我的應用程序時,最下面一行有一些區域被切斷。
設計視圖
運行View
我不明白是什麼原因造成這些觀點之間的這種差異。
<Page x:Class="EzTargetProject.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1280"
Title="HomePage">
<Grid Margin="20,30,20, 170" Grid.Column="4" Grid.Row="4" Background="Gray" ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="150"/>
<RowDefinition Height="150"/>
<RowDefinition Height="150"/>
<RowDefinition Height="150"/>
</Grid.RowDefinitions>
<!-- Name -->
<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Vertical" />
</Grid>
我可能已經注意到問題是什麼,但如果有人能給我一個,我想確認一下。頁面的導航欄是否考慮了頁邊空白,這意味着導航欄的邊距是多少? – 2013-02-16 17:55:38