Bring CustomAnnotation Into View

3 posts, 0 answers
  1. Robert
    Robert avatar
    271 posts
    Member since:
    Mar 2011

    Posted 11 Oct 2012 Link to this post


    My document contains a lot of custom annotations, where each annotation has self generated unique ID.
    Is it possible to bring a defined annotation into view based on its ID value?

    i.e. If the annotation in question is at the top of the first page, but currently I have the last document page in view, can I make radrichtextbox auto scroll to the annotation when required?

    Is it just the case of enumerating through the document searching for the specific annotation ID then setting the caret position to the position of the found annotation field?

    foreach (AnnotationRangeMarkerBase annotationMarker in paragraph.EnumerateChildrenOfType<AnnotationRangeMarkerBase>().ToList<AnnotationRangeMarkerBase>())
         //Move caret to annotation if ID field is a match

    Thank you for your time,

  2. Petya
    Petya avatar
    983 posts

    Posted 16 Oct 2012 Link to this post

    Hello Rob,

    In order to implement the behavior you are describing you'd have to find the annotation that fits the criteria - in your case to find the one with the matching ID. Then you can force the caret to the beginning of the respective annotation. Enumerating through all annotations is a valid way to find a specific one, however I would recommend to cache your annotations, for example in a Dictionary in order to improve the performance.

    After finding the annotation start/end you are looking for, you can use the MoveToInline method of the caret.
    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Robert
    Robert avatar
    271 posts
    Member since:
    Mar 2011

    Posted 16 Oct 2012 Link to this post

    Thanks Petya, I will give it a go,
Back to Top