Adding Custom font for Pivot Header

If you would want to have custom font for the pivot header, you would have to declare the fontfamily separately as shown below in the sample otherwise the displayed font will remain the same.

        <Pivot>
            <PivotItem>
                <PivotItem.Header>
                    <TextBlock Text="Header1" FontFamily="Gotham Bold"/>
                </PivotItem.Header>
            </PivotItem>
        </Pivot>

However if the custom font that you would like to use is not available natively in for the phone and windows. You would be required to add the font file (in TTF) to the project and mark it as “Content” in the Build Action under Properties. After adding the TTF file into the project, you would be able to use it as such in xaml.

        <Pivot>
            <PivotItem>
                <PivotItem.Header>
                    <TextBlock Text="Header1" FontFamily="/Assets/Fonts/Gotham Bold.ttf#Gotham Bold"/>
                </PivotItem.Header>
            </PivotItem>
        </Pivot>
Advertisements
This entry was posted in Silverlight, Windows Phone, winrt and tagged , , . Bookmark the permalink.

One Response to Adding Custom font for Pivot Header

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 )

Google+ photo

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

Connecting to %s