Customize the font list in the Silverlight HTML Editor

One of the controls you’ll find in our Silverlight Elements control suite is the HTML Editor. This provides a familiar UI for users to edit rich text which can later be encoded in HTML. The latest feature we have added to this control is support for developers to change the list of fonts displayed in the font selector. By default, the font selector displays all the fonts supported by Silverlight as seen in this image.

Default Fonts

Now you can specify additional fonts that the user can use as long as they are installed on the users machine. Below you can see I have set the list to contain most of the default fonts along with Gigi, Jokerman, Magneto, Quartz MS and the Precursor Alphabet from the Jak and Daxter video game which I happened to have installed.

Custom Font List

To specify the list of fonts available to the user, all you need to do is set the FontFamilies property on the StandardRichTextEditorToolBar. Here is the code I used to create the above screenshot.

IList<FontFamily> fontFamilies = new List<string>
    "Courier New",
    "Lucida Sans Unicode",
    "Precursor Alphabet",
    "Quartz MS",
    "Segoe UI",
    "Times New Roman",
    "Trebuchet MS",
}.Select(s => new FontFamily(s)).ToList<FontFamily>();
ToolBar.FontFamilies = fontFamilies;

This property is available right now through the current nightly builds which you can download here if you have the trial version, or go to your account page if you are already a customer. If you have any questions or feature requests regarding the Silverlight HTML Editor, we’d love to hear from you in the forum!

One Response to “Customize the font list in the Silverlight HTML Editor”


Join our mailer

You should join our newsletter! Sent monthly:

Back to Top