Dattatray Deokar
Dattatray Deokar

Reputation: 2113

How to set different Selected/Unselected Pivote header color for Multiple Pivot

I have below code in my App.xaml to override pivot item header color

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>                
            <ResourceDictionary x:Key="Default">
                <SolidColorBrush x:Key="PivotHeaderForegroundUnselectedBrush" Color="#CACACA"/>                    
                <SolidColorBrush x:Key="PivotHeaderForegroundSelectedBrush" Color="#D81B60"/>
                <SolidColorBrush x:Key="ButtonPressedForegroundThemeBrush"  Color="Transparent" />
                <ImageBrush x:Key="HubBackgroundImageBrush" ImageSource="Assets/Profile.png"/>
            </ResourceDictionary>                
             <ResourceDictionary x:Key="HighContrast">
                <ImageBrush x:Key="HubBackgroundImageBrush" ImageSource="{x:Null}"/>
            </ResourceDictionary>                
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Application.Resources>

i want to set differernt PivotHeaderForegroundSelectedBrush for different Pivot e.g Pivote1 ->pivoteItem1 -> PivotHeaderForegroundSelectedBrush should be RED

Pivote1 ->pivoteItem2 -> PivotHeaderForegroundSelectedBrush should be RED

Pivote2 ->pivoteItem1 -> PivotHeaderForegroundSelectedBrush should be GREEN

Pivote2 ->pivoteItem2 -> PivotHeaderForegroundSelectedBrush should be GREEN

I tried to override this color theme in Page but it is not working

if i set below style to pivote it changes color but for both Selected and unselected , it there any way to do this for only selected

    <DataTemplate x:Key="PivotHeaderSelectedTemplate">
        <TextBlock Margin="0,10,0,0" 
                   Text="{Binding}" 
                   FontFamily="Segoe UI"
                   FontStyle="Normal"
                   FontSize="44" 
                   Foreground="#630083"/>            
    </DataTemplate>
    <Style x:Key="PivotStyle"
           TargetType="Pivot">            
        <Setter Property="HeaderTemplate"
                Value="{StaticResource PivotHeaderSelectedTemplate}"/>            
        <Setter Property="Margin"
                Value="0"/>
    </Style> 

Upvotes: 1

Views: 948

Answers (1)

Decade Moon
Decade Moon

Reputation: 34306

You can't change it for a specific Pivot, only application-wide. It's a bug. You might be able to change it in code, though. See this thread.

Upvotes: 1

Related Questions