0

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?

K Mehta
  • 10,323
  • 4
  • 46
  • 76
  • Does RT not have `OverflowContentTarget`? If so you might set `OverflowContentTarget="{Binding ElementName=OverflowText}"` on your RichTextBlock, I'd have to test to confirm but seems like a nuance worth checking. – Chris W. Jan 04 '16 at 15:17
  • @ChrisW. It does, and that's what I was using. Sorry I accidentally removed that when I was copy-pasting my XAML. – K Mehta Jan 05 '16 at 01:15

0 Answers0