Highlighting text

3 posts, 0 answers
  1. Shahrzade
    Shahrzade avatar
    8 posts
    Member since:
    Feb 2016

    Posted 14 Apr 2016 Link to this post


    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?





  2. Ralitsa
    Ralitsa avatar
    191 posts

    Posted 15 Apr 2016 Link to this post

    Hello Shahrzade,

    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. 

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Shahrzade
    Shahrzade avatar
    8 posts
    Member since:
    Feb 2016

    Posted 15 Apr 2016 in reply to Ralitsa Link to this post

    Thanks a lot:)


Back to Top