Home > Uncategorized > Updating the font used throughout a #wp8 #app

Updating the font used throughout a #wp8 #app

Using a custom font is a nice design touch that helps a windows phone app stand out, by looking a little different. The Segoe font can be a bit boring…

So, the standard way this is done, is by adding the following into Application.Resources in App.xaml

<Style TargetType=”TextBlock”>
<Setter Property=”FontFamily” Value= “assets/fonts/whatever.ttf#whatever”/>

<Style TargetType=”TextBox”>
<Setter Property=”FontFamily” Value= “assets/fonts/whatever.ttf#whatever”/>

But, here’s another approach, using reflection, and page hooks, like used in a previous post:

So, from within CompleteInitializePhoneApplication, add the code

PhoneApplicationPage page = RootFrame.Content as PhoneApplicationPage;

then, FontChangeHook method as follows;

public static void FontChangeHook(PhoneApplicationPage page)
LoopThroughControls(page, (ui => {
var type = ui.GetType();
var prop = type.GetProperty(“FontFamily”);
if (prop != null)
prop.SetValue(ui, new FontFamily(@”assets/fonts/whatever.ttf#whatever”));


Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: