我对这个问题感到愚蠢,但是如何设置一个网格来使用我的wpf页面的整个空间?我似乎无法将其高度放在" *"而且我希望能够填满整个" DesignHeight / Width"因为我改变了它们。谢谢!
<Page x:Class="Aud10.MenuHome"
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" Title="MenuHome" d:DesignHeight="860" d:DesignWidth="1196">
<Grid Height="860" Width="1196">
<Grid.RowDefinitions>
<RowDefinition Height="0.5*" />
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.333*" />
<ColumnDefinition Width="0.333*" />
<ColumnDefinition Width="0.333*" />
</Grid.ColumnDefinitions>
</Grid>
</Page>
答案 0 :(得分:7)
只需完全删除Width
和Height
设置,然后Grid
将自动填满所有可用空间。
答案 1 :(得分:0)
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="Label" Width="150" />
<TextBox Text="Value" Grid.Column="0" />
</Grid>