C# 如何设置单列网格中文本框的百分比宽度

C# 如何设置单列网格中文本框的百分比宽度,c#,wpf,windows-store,C#,Wpf,Windows Store,除了我在下面创建的hack之外,还有什么方法可以设置单个柱网中文本框的百分比宽度?因为这个解决方案看起来很混乱,我需要设置两列,一列用于控件,另一列用于剩余空间 <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDe

除了我在下面创建的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>

你是对的。这是确保文本框为包含列宽度的80%的唯一方法