Reputation: 1742
I am loading a huge document more than 25MB into the FlowDocument. And everything is fine, but it's taking more cpu or long time during initialization to load the entire data into FlowDocument. Instead of that is there a way to load the page dynamically based on the next page click in the bottom of the FlowDocument Control.
Sample code of the Flow Document.
<ScrollViewer HorizontalAlignment="Stretch">
<GroupBox>
<GroupBox.Header>
<TextBlock Text="Standard Output"></TextBlock>
</GroupBox.Header>
<FlowDocument Name="flowDocument" ColumnWidth="999999" Background="Transparent" IsColumnWidthFlexible="True" >
<Paragraph Name="para" Background="Transparent" TextAlignment="Justify" KeepTogether="True">
</Paragraph>
</FlowDocument>
</GroupBox>
</ScrollViewer>
I am assigning data in the code behind file.
Code to populate the flowdocument in the code behind file.
para.Inlines.Add(ReadDocument());
public void ReadDocument()
{
textToDisplay = File.ReadAllText(@"C:\sampleLog.txt");
}
Upvotes: 0
Views: 289