is there a way to tell WPF that I'm going to do a lengthy update on a control (TextBlock), and that it shouldn't redraw it until I tell it I'm done? I'm adding a large number of items to the Inlines property, and it has to redraw the entire control every time I add an item, which takes a very long time - about 1 second for every 100 items. I know some other frameworks allow freezing of certain controls, but I haven't been able to find anything in the documentation or on google. I've tried collapsing the TextBlock, and then making it visible again after the update, but it did not improve the performance at all.

06-11-2012

Elkvis

I decided to go a different route. I'm now using a RichTextBox control, and adding my items to a Paragraph object, which I then add to the FlowDocument inside the RichTextBox. RichTextBox handles formatted text much faster than TextBlock, so the operation that was taking 30 seconds now happens in under a second.

I normally wouldn't revive a post this old, but I actually looked into data binding the RichTextBox, and discovered that it's not a trivial task. it seems to involve subclassing a number of things, and for code that will never run apart from this particular view, it wasn't worth the effort, when I've got many other projects demanding my attention.