Detect if the current selection has bullets

2 posts, 1 answers
  1. Simon
    Simon avatar
    27 posts
    Member since:
    Aug 2011

    Posted 15 Aug Link to this post

    I have a radRichTextEditor in a small space so there is no room for a RichTextEditorRibbonBar. Instead I'm putting all of the formatting options I need on the context menu. I've added a "Bullets" menu item to the context menu and got this working to add bullets to the selected text. However I'd like this to work in a Toggle fashion so that if the selected text already has bullets, it removes them. If the selected text doesn't have text, it adds them. How do I work out if the selected text has bullets or not?
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 16 Aug Link to this post

    Hello Simon,

    You can use the CurrentEditingStyleChanged event to check if the cursor is within a bullet list. Here is the code:
    private void RadRichTextEditor1_CurrentEditingStyleChanged(object sender, EventArgs e)
    {
        var helper = new StyleUIHelper(radRichTextEditor1.RichTextBoxElement);
        var isBulletList = helper.GetIsBulleted();
        Debug.WriteLine(isBulletList);
    }

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

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top