1
因此,例如...在下面的用户控件中,我有一个两行的网格。我希望最下面一行是内容的高度,最上面一行是网格其余部分的高度。我可以像示例中那样设置绝对高度,但这不是特别灵活。说别人改变字体大小的文字可能会被剪辑。是否有任何内置的方法来实现这一目标?行或列定义可以自动调整为其内容的尺寸
<UserControl x:Class="Tournament.View.TeamCreator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Grid x:Name="LayoutRoot" Background="White" ShowGridLines="True">
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Grid Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Text="TEAM NAME" />
<TextBox Grid.Column="1" Grid.Row="0" />
<TextBlock Grid.Column="2" Grid.Row="0" Text="MANAGER NAME" />
<TextBox Grid.Column="3" Grid.Row="0" />
<Button Grid.Column="4" Grid.Row="0" />
</Grid>
</Grid>
</UserControl>
甜蜜的作品,欢呼声 – 2009-02-11 14:13:04