VISHAL TANK
VISHAL TANK

Reputation: 235

How to change the Font Size of Selected pivot item in UWP

PivotItem SelectedPivot;
        SelectedPivot = (PivotItem)AIP_Pivot.SelectedItem;
        SelectedPivot.FontSize = 35;

I have implemented this code but it doesn't work. Can anyone tell me why? and What is the solution?

Upvotes: 0

Views: 287

Answers (1)

Ipsit Gaur
Ipsit Gaur

Reputation: 2927

Try using default Pivot style and templates provided by Microsoft and editing the foreground there for the selected item like this:

<VisualState x:Name="Selected">
              <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                               Storyboard.TargetProperty="Foreground" >
                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
                </ObjectAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Grid"
                                               Storyboard.TargetProperty="Background" >
                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}" />
                </ObjectAnimationUsingKeyFrames>
              </Storyboard>
            </VisualState>

You can look for entire style for pivot item here.

Upvotes: 1

Related Questions