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

How to get Highlighted Text in a RadRichTextBox

1 Answer 131 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 02 Feb 2011, 10:50 AM
Hi guys,

I am trying to get the highlighted text in a RadRichTextBox.

I can access the Selection object, but there is no property Text.

richTextArea.Document.Selection

Any suggestions ?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 03 Feb 2011, 09:33 AM
Hello Joseph,

There is a method in DocumentSelection called GetSelectedText, so you can use something like this:
string selectedText = richTextArea.Document.Selection.GetSelectedText();
It is available as a method rather than a property to point that it's a relatively costly operation and repetitive calling should be avoided where possible.

Kind regards,
Ivailo
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
RichTextBox
Asked by
Joseph
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Share this question
or