我有一些情况,即我有自动切除的小组或网格,但如果它们包含一个<条码>TextBox和TextWrapping=“Wrap”
,<条码>TextBox继续将小组/电网扩展至其真正需要之前的一段时期内,例如:
What I am looking to do is to have the TextBox
fill its area by wrapping text before it tries to expand to the right. A simplified example of the issue is:
<Grid>
<Grid Background="Black" />
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox TextWrapping="Wrap" Height="120" MinWidth="200" />
</Grid>
</Grid>
我在Stack Overflow 上发现了一个类似的问题,但所张贴的最佳解决办法不允许扩大TextBox
。 这种解决办法类似:
<Grid>
<Grid Background="Black">
</Grid>
<Grid VerticalAlignment="Top" HorizontalAlignment="Left" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="0" x:Name="border" Margin="0.5" />
<TextBox TextWrapping="Wrap" Height="120" MinWidth="200" Width="{Binding ActualWidth, ElementName=border}" />
</Grid>
</Grid>
除扩大<代码>TextBox外,还有经修改的行为?