How to display font family in ribbon control using combobox?

2 posts, 0 answers
  1. shosho
    shosho avatar
    1 posts
    Member since:
    Dec 2014

    Posted 12 Dec 2014 Link to this post

    Can any one help me display the font family in ribbon control using combo box, i do know how to do this without the ribbon control but it doesnt seem to work the same. This is what i use without the ribbon control and it works. thank you in advance
  2. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 16 Dec 2014 Link to this post

    Hello shosho,

    Thank you for writing.

    Please find below a code snippet populating all available fonts in a dropdown list of a RadRibbonBar control:
    public Form1()
    {
        InitializeComponent();
        this.SetFontFamilyItems();
    }
     
    private void SetFontFamilyItems()
    {
        InstalledFontCollection font = new InstalledFontCollection();
        foreach (System.Drawing.FontFamily family in font.Families)
        {
            if (family.IsStyleAvailable(System.Drawing.FontStyle.Regular) &&
                family.IsStyleAvailable(System.Drawing.FontStyle.Italic) &&
                family.IsStyleAvailable(System.Drawing.FontStyle.Bold))
            {
                this.radDropDownListElement.Items.Add(family.Name);
            }
        }
     
    }
     
    I would also suggest that you get acquainted with our RichTextEditor control which provides a fully functional ribbon bar with text editing capabilities out of the box. The functionality of the RichTextEditor is very well displayed in our demo application, the source code is usually located at: C:\Program Files (x86)\Telerik\UI for WinForms Q3 2014\Examples\RichTextEditor.

    Hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top