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

How to display font family in ribbon control using combobox?

1 Answer 58 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
shosho
Top achievements
Rank 1
shosho asked on 12 Dec 2014, 12:25 PM
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

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 16 Dec 2014, 09:00 AM
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.

 
Tags
RibbonBar
Asked by
shosho
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or