I have encountered a strange problem with the ApplyPropertyValue method of the TextRange object. The following code segment works fine for a small amount of text in the WPF RichTextBox rtb, but hangs indefinitely when the RichTextBox contains a larger number of text:
TextRange r = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
r.ApplyProperyValue(TextElement.ForegroundProperty, new SolidColorBrush(Colors.Lightgreen));
Any ideas?