Yes, the possibility of using virtualization occurred to me also, but I quickly gave that up since I cannot find a way to combine it with smooth scrolling. Each item in a forum thread will obviously have a considerable height, in the case of a long post much higher than the viewport, and if the scrollviewer cannot scroll smoothly between these items, virtualization is simply not an option.
I have done a little feasibility study now and sadly come to the conclusion that RadRichTextBox is not going to work for me. It is far too heavy and memory intensive to be used in a multiple-instance scenario like this. What I did was put the Microsoft RichTextBox control in the item template of an items control and compared the performance against RadRichTextBox when used in the same fasion. When displaying a short document (3-4 paragraphs of text), I could easily generate a couple of hundred instances of MS RichTextBoxes and still get decently smooth scrolling and a reasonable memory footprint (awful compared to html displayed in a web browser, but still acceptable). With RadRichTextBox I could generate no more than 20 items until the page became almost unusable. When generating 40 items it took about 6-7 seconds for them to even appear. Any more than that and the page crashed and burned in some sort of layout cycle exception. And I have not even mentioned memory consumption. I am attaching my test project for your convenience. Please take a look and see for yourselves.
While RadRichTextBox seems to be a very powerful component when used in a single instance for reading and writing large documents, I feel that you have completely missed the scenario where a rich text component is used to display small "islands" of rich text scattered throughout a page. Surely I cannot be the only person needing a rich text component for a scenario such as this? I know I have seen forum threads asking about using RadRichTextBox in a cell within RadGridView. That is a pretty similar scenario to mine.
I want to ask you to consider implementing something like a RadRichTextBlock
, stripped of all editing functionality, context menus, spell checking etc. and only used to render and display rich text produced using RadRichTextBox. The only interactivity needed (at least that I can think of) would be text selection.
Alternatively, is there a way of pulling Xaml from RadRichTextBox that can be rendered using a plain MS RichTextBox? Or maybe "normal" xaml that could just be displayed in a ContentControl? If I could do that I would have a workaround at least.