【发布时间】:2015-04-20 05:52:29
【问题描述】:
除了我在下面创建的 hack 之外,还有什么方法可以在单个列网格中设置文本框的百分比宽度?由于这个解决方案看起来很混乱,因为我需要设置两列,一列用于控制,另一列用于剩余空间。
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.Row="0" Background="Red">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".8*"/>
<ColumnDefinition Width=".2*"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Background="Gray" Text="Hello world" Foreground="Black"/>
</Grid>
</Grid>
【问题讨论】:
标签: c# wpf windows-store