MeeKaaH
MeeKaaH

Reputation: 211

WP8 Change pivot header color (selected / unselected)

I need to change a pivot header color but still have a different color for selected and unselected pivot item headers.

I can easily change the color of all the headers but i really need a way to differentiate selected and unselected pivot items.

I have tried many ways to do this for windows phone 7 but the pivot header architecture seem to have changed and the styles no longer work.

Upvotes: 3

Views: 1480

Answers (1)

Evert
Evert

Reputation: 354

I couldn't find a direct way of doing this by for example creating a new headertemplate, but you change this applicationwide by overriding the correct solidcolorbrushes in the theme dictionary. So in App.xaml:

<Application>
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Default">
          <SolidColorBrush
            x:Key="PivotHeaderForegroundUnselectedBrush"
            Color="Purple"/>
        <SolidColorBrush
            x:Key="PivotHeaderForegroundSelectedBrush"
            Color="Orange"/>
        </ResourceDictionary>
      </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
  </Application.Resources>
</Application>

This is not a completely foolproof approach, it is explained in more detail at http://msdn.microsoft.com/library/windows/apps/br208807

Upvotes: 7

Related Questions