How do I handle/edit large amount of text in WPF?

I am not sure if this helps, but have you tried using FlowDocumentPageViewer and FlowDocumentReader?

It also has very good annotations support and looks ideal for loading documents in text format.


The problem is that the TextBox is a single container element. List controls, such as ListBox virtualize very well because of container recycling. There really isn't anything simple that you can do to speed up the TextBox.

But the TextBox control does have an AppendText() method:

        TextBox tb = new TextBox();
        tb.AppendText("Hello");

So yes, you can use this to dynamicly add some text just like you mentioned.


AvalonEdit, the text editor in SharpDevelop, was written completely from scratch in WPF and is optimized for large amounts of text. It doesn't support rich text (although it does support syntax highlighting and other cool features such as folding). I think this might fit your bill perfectly.

Here is an article on the editor written by the developer:

http://www.codeproject.com/KB/edit/AvalonEdit.aspx