Performance on removing multiple AnnotationRanges

2 posts, 0 answers
  1. Charles
    Charles avatar
    41 posts
    Member since:
    Mar 2012

    Posted 03 Dec 2012 Link to this post

    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
  2. Boby
    Admin
    Boby avatar
    595 posts

    Posted 05 Dec 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top