Windows Phone 8.1, how do I customize the pivot head style? Use the pivot control to accomplish this effect.
Looking for a long time online, only found the solution of Windows Phone 8. Finally a great God gave a recruit, I think I need to share with you developers experience. There are too few development data for Windows Phone 8.1. I decided to share what I know with a holiday.
If you support my approach . Please like or comment on this blog, or go to the Windows Phone store to download an app called "Little meaning", or wish my big black rabbit to lose weight successfully. The Big black Rabbit will be very happy. A little bit of meaning: HTTP://WWW.WINDOWSPHONE.COM/ZH-CN/STORE/APP/%E6%9C%89%E7%82%B9%E6%84%8F%E6%80%9D/F2E705B4-5FD6-4C69-826B-C2F05C825EF0
All right, rip it off and start working.
1. Define your own pivot control style in App.xaml. The following code is added to the Application.Resources node so that each of your pages will be able to use this style.
<style targettype= "Pivot" >
<setter property= "Template" >
<Setter.Value>
<controltemplate targettype= "Pivot" >
<grid
X:name= "RootElement"
Horizontalalignment= "{TemplateBinding HorizontalAlignment}"
Verticalalignment= "{TemplateBinding verticalalignment}"
Background= "{TemplateBinding Background}" >
<VisualStateManager.VisualStateGroups>
<visualstategroup x:name= "Orientation" >
<visualstate x:name= "Portrait" >
<Storyboard>
<objectanimationusingkeyframes storyboard.targetname= "Titlecontentcontrol" storyboard.targetproperty= "Margin" >
<discreteobjectkeyframe keytime= "0" value= "{ThemeResource pivotportraitthemepadding}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<visualstate x:name= "Landscape" >
<Storyboard>
<objectanimationusingkeyframes storyboard.targetname= "Titlecontentcontrol" storyboard.targetproperty= "Margin" >
<discreteobjectkeyframe keytime= "0" value= "{ThemeResource pivotlandscapethemepadding}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<rowdefinition height= "Auto"/>
<rowdefinition height= "*"/>
</Grid.RowDefinitions>
<border background= "Red" >
<contentcontrol x:name= "Titlecontentcontrol"
Style= "{StaticResource Pivottitlecontentcontrolstyle}"
Content= "{TemplateBinding Title}"
Contenttemplate= "{TemplateBinding titletemplate}"/>
</Border>
<scrollviewer
X:name= "ScrollViewer"
Margin= "{TemplateBinding Padding}"
grid.row= "1"
Horizontalsnappointstype= "Mandatorysingle"
Horizontalsnappointsalignment= "Center"
Horizontalscrollbarvisibility= "Hidden"
Verticalscrollmode= "Disabled"
Verticalscrollbarvisibility= "Disabled"
Verticalsnappointstype= "None"
Verticalcontentalignment= "Stretch"
Zoommode= "Disabled"
Template= "{StaticResource scrollviewerscrollbarlesstemplate}" >
<pivotpanel x:name= "Panel" verticalalignment= "Stretch" >
<pivotheaderpanel x:name= "Header" background= "Red" >
<PivotHeaderPanel.RenderTransform>
<compositetransform x:name= "Headertranslatetransform" translatex= "0"/>
</PivotHeaderPanel.RenderTransform>
</PivotHeaderPanel>
<itemspresenter x:name= "Pivotitempresenter" >
<ItemsPresenter.RenderTransform>
<translatetransform x:name= "Itemspresentertranslatetransform" x= "0"/>
</ItemsPresenter.RenderTransform>
</ItemsPresenter>
</PivotPanel>
</ScrollViewer>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2. In the page that calls pivot, define the Primitives namespace and add the following code.
Xmlns:primitives= "Clr-namespace:microsoft.phone.controls.primitives;assembly=microsoft.phone"
3. In the page where you want to use pivot, specify this style for pivot:
<pivot style= "{StaticResource Diaosbookpivotstyle}" >
Quit, leave.
WP8.1 Windows Phone 8.1 development: Define pivot Head style, define pivot head color