views:

1150

answers:

2

Is there any limitations to the WPF Document.Paragraph object when using the FlowDocument control?

I have the FlowDocument turning blank when I add a Paragraph that is more than 450 lines to the Paragraph. I could not locate anything within the MSDN documentation regarding max. lengths etc.

Any ideas why this would happen?

A: 

I made a quick test and added 10000 Runs to a Paragraph, and the FlowDocument seemed to display them fine (although it took a bit to calculate the number of pages):

Paragraph p = new Paragraph();
for (int i = 0; i < 10000; i++)
{
    p.Inlines.Add(new Run(String.Format("({0}) Sphinx of black quartz, judge my vow! ", i)));
}
wnd.Content = new FlowDocument(p);

Is there something peculiar about the lines you're adding to the Paragraph?

Robert Macnee
A: 

The issue is fixed when IsOptimalParagraphEnabled is set as False. Then the content will be displayed.

Seems this property causes issues with large paragraphs.

Luke