嗨我有一个TextBox
,我想填充我为它定义的网格。要做到这一点,我把它放在拉伸,所以它可以适合。问题是文本将被写在顶部而不是中心。如果我将对齐设置为居中,则TextBox
将不再延伸。
<TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Text="Wall Temperature [C]"/>
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="3" Grid.Column="1" Text="150.0"/>
<TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="4" Grid.Column="0" Text="Wall Temperature [C]"/>
<TextBox HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="4" Grid.Column="1" Text="150.5"/>
看起来像这样