UWP pivot on which navigate to other pages

1.9k views Asked by At

How to make a pivot on a UWP that if the button on the header tab is selected, it will navigate to other pages? And how to using image on header tab? For example in the image below if selected tab header "Store", it will navigate to "Store" page.

tab header

I've tried searching for the way, but in the sample provided only to show the tab header and text only.

2

There are 2 answers

1
Sanjay On

You need to add appropriate styling to your pivot header item to have it display both the text and an icon.

You can refer to the answer provided here: how to add images for pivot item header

1
M. Pipal On

You can use Pivot control with Frames, if you want to navigate to concrete page.

XAML

<Pivot x:Name="MainPivot">
   <PivotItem Header="Store">
      <Frame x:Name="StorePage" />
   </PivotItem>
   <PivotItem Header="Library">
      <Frame x:Name="LibraryPage" />
   </PivotItem>
</Pivot>

Code-behind

public MainPage()
{
   this.InitializeComponent();
   StorePage.Navigate(typeof(StorePage));
   LibraryPage.Navigate(typeof(LibraryPage));
}