Michał Jankowski
Michał Jankowski

Reputation: 427

wp7 PivotItem HeaderTemplate

I want to have each header font set to different color. It should be very easy, but it's not. I was looking for it several ours. I have found one solution, but it doesn't work for me.

Here is the code:

<controls:Pivot Margin="0" Title="ALL NOTES" VerticalAlignment="Top" HeaderTemplate="{StaticResource DataTemplate1}"  >
        <controls:PivotItem Header="notebooks" Foreground="White" Height="600"> ...

...<DataTemplate x:Key="DataTemplate1">
        <controls:Pivot ItemsSource="{Binding Items}" > 
            <controls:Pivot.HeaderTemplate> 
                <DataTemplate> 
                    <Grid  Width="200" Height="100"> 
                        <TextBlock Margin="0" Text="{Binding Title}" /> 
                    </Grid> 
                </DataTemplate> 
            </controls:Pivot.HeaderTemplate> 
        </controls:Pivot> 
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

Upvotes: 0

Views: 3274

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65564

The template of the item header is defined at the pivot level, not the pivotItem level. This means that you can't overwrite the template at the pivotItem level.

If you really must do this you'll need to derive your own version of the pivot control which supports this functionality.

Upvotes: 1

Related Questions