This is a migrated thread and some comments may be shown as answers.

Performance on removing multiple AnnotationRanges

1 Answer 100 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 03 Dec 2012, 03:00 PM
Hi

I have a specific requirement that involves removing a number of annotation ranges at a time.  The only way I can see of doing this is via the Document "Delete" commands to remove them one at a time (some of these are read only ranges, so I can't just create a selection across them all and Delete the selection).

I've stepped through the code and the process of removing these individually called "EnsureDocumentArrangedAndMeasured" after each one is removed, which for a large file absolutely kills the performance.  Is there any way I can improve this?

Thanks

Charlie

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 05 Dec 2012, 09:53 AM
Hi Charles,
What could perform better is RadDocument.DeleteCustomAnnotationRange method, enclosed in RadDocument.BeginUpdate and EndUpdate:
this.radRichTextBox.Document.BeginUpdate();
foreach (var annotationRangeStart in this.radRichTextBox.Document.GetAnnotationMarkersOfType<AnnotationRangeStart>().Reverse().ToList())
{
    this.radRichTextBox.Document.DeleteCustomAnnotationRange(annotationRangeStart);
}
this.radRichTextBox.Document.EndUpdate();


Kind regards,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Charles
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or