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

Get Field in CaretPosition

1 Answer 49 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 04 Apr 2015, 11:14 PM

Hi,

How can I get a reference to a field that is at the current

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 07 Apr 2015, 05:11 PM
Hi William,

The Fields can be interpreted as an Annotations, as their FieldRangeStart/FieldRangeEnd derive respectively from AnnotationRangeStart/AnnotationRangeEnd. You could get the current inline using the CaretPosition's GetCurretnInline method and obtain the annotation ranges which surround it with GetContainingAnnotationRanges<TRangeStart>():
Inline inline = this.radRichTextBox.Document.CaretPosition.GetCurrentInline();
IEnumerable<AnnotationRangeStart> ranges = this.radRichTextBox.Document.GetContainingAnnotationRanges<FieldRangeStart>(inline);

More information about how to work with Annotations can be found in the Manipulating Annotations article in our documentation.

Regards,
Tanya
Telerik
 

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

 
Tags
RichTextBox
Asked by
William
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or