How to change font size of Panorama item header?

Buju picture Buju · May 16, 2011 · Viewed 16.5k times · Source

What is the easiest way to set the font size of the panorama item header once so it can be used for all item headers in my app?

Answer

Matt Lacey picture Matt Lacey · May 16, 2011

There isn't a way to automatically do it for all headers in your app yet. You'll need to set the style for each one.

Implicit styling is coming in the Mango update and that should allow this to be done then.

Update
Here's what you can do now.

Create a global template style for the FontSzie you want. Something like:

<Application.Resources>
    <DataTemplate x:Key="MyItemHeaderTemplate">
        <Grid>
            <ContentPresenter>
                <TextBlock Text="{Binding}" FontSize="20" />
            </ContentPresenter>
        </Grid>
    </DataTemplate>
</Application.Resources>

Then in every PanoramaItem that I wish to have styled this way I set the HeaderTemplate:

<controls:PanoramaItem Header="first" HeaderTemplate="{StaticResource MyItemHeaderTemplate}">
    // ...
</controls:PanoramaItem>