2

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.

Rose
  • 613
  • 4
  • 22

2 Answers2

4

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));
}
M. Pipal
  • 734
  • 11
  • 24
  • I've tried with the code you provided, but when running the application, the application can not be run and display an error message, like this picture: https://1drv.ms/i/s!Auqiv8Ukng7U7Q72Q7lLbL0yD0Hj – Rose Jul 28 '16 at 02:40
0

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

Community
  • 1
  • 1
Sanjay
  • 458
  • 5
  • 13
  • I've tried using code-code on "how to add images for pivot item header" but nothing worked. Can you give a sample to pivot using pictures? – Rose Jul 28 '16 at 02:50