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

Store CaretPosition in XAML

1 Answer 23 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Christoph
Top achievements
Rank 1
Christoph asked on 21 Jun 2012, 11:08 AM
Hello

I'd like to know whether it is possible to store the current
caret position of a RadDocument into the XAML string
persisted by the XamlFormatProvider?

We sometimes insert textfragments into a XAML copy of a RAD document
at runtime.
Then replace the whole RRTB document by the modified copy.
After the replacement  the caret position is lost -
of course.
If the info would get stored into the persisted XAML, it'll be fine.
Is there a way to achieve it and store the caret position into XAML?

Thx,
Chris

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 22 Jun 2012, 08:01 AM
Hi Chris,

It is not possible to store the caret position in XAML. What you can do is to add a bookmark or some other annotation at the position of the caret just before the export. Then, after import, find this bookmark and position the caret there. After that, you can remove this bookmark, so as to preserve the initial document.

You can read more about bookmarks in this article. You can also use a custom annotation, following the approach described here.

Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Christoph
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or