Consider something as follows:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="WrapTextBlock" Grid.Column="0" Text="123 456 789 0123 4456 123 123 123 123 1 23 123 " TextWrapping="Wrap" />
<TextBlock x:Name="NotWrapTextBlock" Grid.Column="1" Text="GGG" />
</Grid>
This XAML will allow WrapTextBlock
text to be wrap, doing this, WrapTextBlock
will take all the space and push NotWrapTextBlock
to the right.
But what I want to do is to have WrapTextBlock
take as less space as possible, pushing NotWrapTextBlock
right after WrapTextBlock
and fill the right side with empty space.
Which means the following:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="WrapTextBlock" Grid.Column="0" Text="123 456 789 0123 4456 123 123 123 123 1 23 123 " TextWrapping="Wrap" />
<TextBlock x:Name="NotWrapTextBlock" Grid.Column="1" Text="GGG" />
</Grid>
But the thing here is, now the text in WrapTextBlock
wouldn't wrap anymore.
I mean something like follows:
When text is too long it requires to warp:
When text is short enough that doesn't requires to warp: