Reduce the available fonts in the RadRichTextBoxRibbonUI

2 posts, 0 answers
  1. ANTONIO
    ANTONIO avatar
    4 posts
    Member since:
    Aug 2019

    Posted 08 Apr Link to this post

    Hi,
    I'm using RadRichTextBoxRibbonUI to handle a richtext box.

    By default the control creates a drop down list with all the available fonts of the system. I would like to restrict my user and provide him/her with specific ones.

    I wold like that the fonts are not show in the drop down and not load them in the document, for instance if the user paste some text with other font the editor will not recognize the font and paste it with one of the defaults.

    How do I do that?

     

    Thanks!

  2. Dimitar
    Admin
    Dimitar avatar
    2907 posts

    Posted 09 Apr Link to this post

    Hi Antonio,

    You can inherit the RichTextEditorRibbonBar which will give you access to the drop-down list. Then you can hide the undesired items: 

    class CustomRichTextEditorRibbonBar : RichTextEditorRibbonBar
    {
        public CustomRichTextEditorRibbonBar()
        {
            foreach (var item in dropDownListFont.FontListView.Items)
            {
                if (item.Value.ToString().StartsWith("Arial"))
                {
                   item.Visible = false;
                }
            }
        }
    }

    I hope this helps. Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top