How to link RichTextBlockOverflow to RichTextBlock?

57 Views Asked by At

I have the following code in Xamarin C#, I wish to link the RichTextBlockOverflow in the following code to the RichTextBlock above it so that the overflowed content is displayed. I am trying to create horizontal pagination using this, so please let me know if I am in the right direction. Thanks :)

XAML:

<StackPanel  Height="{Binding ActualHeight, ElementName=grid}"  
             Width="{Binding ActualWidth, ElementName=grid}" 
             HorizontalAlignment="Center" 
             VerticalAlignment="Center">
                <RichTextBlock Height="{Binding ActualHeight, ElementName=grid}" 
                               MaxHeight="{Binding MaxHeight, ElementName=grid}"            
                               Name="TextBlock" 
                               local:HtmlToRtfConverter.Html="{Binding Html}" />
                <RichTextBlockOverflow Name="RichBlockOverflow" />
</StackPanel>
1

There are 1 best solutions below

0
Singhal2 On

Found an answer:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <RichTextBlock Grid.Column="0" 
                   OverflowContentTarget="{Binding ElementName=overflowContainer}" >
        <Paragraph>
            Proin ac metus at quam luctus ultricies.
        </Paragraph>
    </RichTextBlock>
    <RichTextBlockOverflow x:Name="overflowContainer" Grid.Column="1"/>
</Grid>

Source: Link