RichTextBlock overflow is missing the first line of text

98 Views Asked by At

I've got a Grid that is dynamically sized based on the size of the window it is in. The grid has three children: an Image, a RichTextBlock, and a RichTextBlockOverflow. When the window is sized down enough to ensure that the height of the RichTextBlock becomes 0, the overflow content does not include the first line (which the RichTextBlock couldn't visibly render.

In the sample code below (reduced to just show the essentials), I only see "World" in my overflow.

<Grid MinHeight="200" MinWidth="400">
    <Grid.RowDefinitions>
        <RowDefinition Height="200" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Image />
    <RichTextBlock x:Name="Text" Grid.Row="1" OverflowContentTarget="{Binding ElementName=OverflowText}">
        <Paragraph>Hello<LineBreak />World</Paragraph>
    </RichTextBlock>
    <RichTextBlockOverflow Name="OverflowText" Grid.RowSpan="2" Grid.Column="1" />
</Grid>

Is there any way to ensure that the overflow would have all the text in case the RichTextBlock doesn't have enough space to render the first line?

0

There are 0 best solutions below