Using a new font family in a Silverlight application is fairly simple. There are several ways for doing it. The simplest of them is adding the TTF file to our application (simple drag & drop when using the Visual Studio IDE) and referring it from within the XAML file.

<UserControl x:Class="SilverlightApplication15.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock FontSize="24" FontFamily="Foo.ttf#Foo">We Love Silverlight!</TextBlock>
    </Grid>
</UserControl>

The following video clip shows how does it work.

Leave a Reply

Your email address will not be published. Required fields are marked *