【发布时间】:2014-09-11 18:50:29
【问题描述】:
我正在使用下面的代码创建一个带有网格的 3 列布局。
<Window x:Class="WpfApplication21.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Column="0" Background="Aqua"></Grid>
<Grid Column="1" Background="Red"></Grid>
<Grid Column="2" Background="Yellow"></Grid>
</Grid>
</Window>
我不明白的部分是,当我将第三个网格的Visibility 设置为Collapsed 时,它所占用的空间仍然存在。我希望将剩余空间添加到其他两个网格中。
<Grid Column="2" Background="Yellow" Visibility="Collapsed"></Grid>
【问题讨论】: