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

Highlighting text

2 Answers 70 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Shahrzade
Top achievements
Rank 1
Shahrzade asked on 14 Apr 2016, 09:27 AM

Hi,

I have a RadRichTextEdior, the user selects a piece of text and wants to highlight it with a chosen color , e.g., by clicking on a button. How can I do it programatically? How can I get hold of the selected text (its start and its end)?

Is there anything like ChangeParagraphBackgroundColorCommand for  selected text?

 

Thanks,

 

Shahrzade.

2 Answers, 1 is accepted

Sort by
0
Ralitsa
Telerik team
answered on 15 Apr 2016, 06:50 AM
Hello ,

Thank you for contacting us. 

In order to highlight the selected text, you can use the ChangeFontHighlightColorCommand. However keep in mind that you need to pass as argument a color instance locate in the following namespace: Telerik.WinControls.RichTextEditor.UI.Color. Please refer to the code snippet below: 
private void radButton1_Click(object sender, EventArgs e)
{
    this.radRichTextEditor1.Commands.ChangeFontHighlightColorCommand.Execute(Telerik.WinControls.RichTextEditor.UI.Color.FromRgb(21, 135, 173));          
}

In addition, more information about can be found: RichTextEditor >> Features >> Selection and RichTextEditor >> Features >> Commands 

Finally, I can suggest using the built-in Selection Mini Toolbar which is a floating toolbar with the most commonly used commands for formatting text.

Please, let me know if there is something else I can help you with. 

Regards,
Ralitsa
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Shahrzade
Top achievements
Rank 1
answered on 15 Apr 2016, 08:02 AM

Thanks a lot:)

Shahrzade.

Tags
RichTextEditor
Asked by
Shahrzade
Top achievements
Rank 1
Answers by
Ralitsa
Telerik team
Shahrzade
Top achievements
Rank 1
Share this question
or