Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to navigate to pivot control page by a button clicked event

I'm trying to create a wp7 pivot control application. On click of a button in the first page, I would like to navigate to another page which is already a pivot page. Is it possible ?

like image 873
New developer Avatar asked Mar 03 '11 05:03

New developer


3 Answers

If you have for example following definition for the Pivot control:

 <controls:Pivot x:Name="SettingsPivot" Title="settings">
   <controls:PivotItem x:Name="GeneralSettings" Header="general settings">
     <!-- Pivot Item content -->
   </controls:PivotItem>
   <controls:PivotItem x:Name="ConnectivitySettings" Header="connectivity settings">
     <!-- Pivot Item content -->
   </controls:PivotItem>
   <controls:PivotItem x:Name="OtherSettings" Header="other settings">
     <!-- Pivot Item content -->
   </controls:PivotItem>
 </controls:Pivot>

Then you can go to for example OtherSettings using this code in the button click event handler:

SettingsPivot.SelectedItem = OtherSettings;
like image 170
Jari Avatar answered Nov 19 '22 12:11

Jari


do it like this

NavigationService.Navigate(new Uri("/Pages/Page.xaml?PivotMain.SelectedIndex = 0", UriKind.Relative));

SelectedIndex can be whatever depending how many pivot items you have

like image 25
sk1tz0 Avatar answered Nov 19 '22 13:11

sk1tz0


Here is how you can navigate to another page, it does not matter if it is a pivot page or not:

NavigationService.Navigate(new Uri("/SettingsPivot.xaml", UriKind.Relative));

If you are trying to navigate to another pivotitem then you will need to do the following

int i=1; //This is the index of the pivotitem you would like to navigate to

PivotMenuName.SelectedIndex = i;
like image 3
andersra Avatar answered Nov 19 '22 14:11

andersra