How to get the cursor current position for radrichtextbox?
like the Silver light control text box has property SelectionStart to get the current position of the cursor.
3 Answers, 1 is accepted
0
Ivailo Karamanolev
Telerik team
answered on 11 May 2012, 09:36 AM
Hello,
You can access the current caret position through the RadDocument.CaretPosition property. More on this you can learn in the online help articles on positioning and selection.
Greetings,
Ivailo Karamanolev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I am having an issue with positioning the cursor via the .MoveToPosition() method. When I do this, the cursor gets placed correctly, but the document window adjusts so that the cursor is the last line that is shown.
For example, my RadRichTextBox displays 10 lines at any given time and I have 50 lines of text in the document. If I move the cursor to a place in the text that is on the 30th line, it will put the 30th line at the bottom of the display. I would like for it to put the selected line in the middle of the displayed area OR not move the display at all, just move the cursor.
Hope this makes sense....
Tks.
0
Andrew
Telerik team
answered on 23 May 2012, 12:58 PM
Hi Brian,
A ready-to-use method for such functionality is not available out of the box. However you can use the following code:
DocumentPosition positionYouWantTheCaretOn = ...//logic finding the needed position