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

SplitAnnotationRange on typing

1 Answer 98 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 02 Apr 2015, 10:31 PM
I have created a custom AnnotationRange following the CustomLayerAndCustomAnnotation example and I would like any text the user types in the editor to break this annotation range and only show content that was loaded with this range and never edited to show up in the range.

I'm calling SplitAnnotationRange on the current AnnotationRange in a PreviewEditorKeyDown event handler after I have determined that they keypress was one that would insert content. The annotation range is split at the correct position but my cursor is not placed in the area of the split, it is at the start of the second range. If I call CaretPosition.MoveToPrevious the cursor ends up at the end of the first annotation range.

I have tried all combinations of SkipPositionBefore on my start and end ranges but I believe the correct settings are False on the RangeStart and True on the RangeEnd which should make the position between a RangeEnd and a RangeStart a valid editable position.

Is there any easier way to get content inserted by the user to automatically split my annotation range or to get the cursor to go into the position between the RangeEnd and RangeStart after SplitAnnotationRange.

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 07 Apr 2015, 05:05 PM
Hello Rick,

You are exactly right, whether or not the content between the two ranges is editable after the split entirely depends on the setup of the SkipPositionBefore/After of the annotation range. I'm afraid I couldn't advise on an easier approach to achieve the desired result.

The scenario is interesting though and I will raise it for discussion with the development team. If there is demand for such functionality we may introduce annotations that will be automatically split when you start typing in them, instead of adding content inside the range.

Let us know if you have other questions.

Regards,
Petya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
RichTextBox
Asked by
Rick
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or