Is it possible to go to the rotation control page using an event with the click of a button

I am trying to create a pivot control wp7 application. When I click the button on the first page, I would like to go to another page, which is already a summary page. Is it possible?

+7
source share
6 answers

If you have, for example, the following definition for a Pivot element:

<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, other settings using this code in the button click event handler:

 SettingsPivot.SelectedItem = OtherSettings; 
+33
source

do it like that

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

SelectedIndex can be any, depending on how many support elements you have

+6
source

Here's how you can go to another page, no matter if it is a summary page or not:

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

If you are trying to switch to another pivotitem, 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; 
+3
source

It sounds like you need a second piece of code. If your Pivot has 2 elements (for example, item1, item2), then to go to item2 from item1 you will use:

 MyPivot.SelectedIndex = IndexOfPageToGoTo; 

Check out this quick example to demonstrate it.

http://dl.dropbox.com/u/129101/WindowsPhonePivotApplication1.zip

However, this is not recommended if you use it for a Wizard style application. See http://timheuer.com/blog/archive/2010/08/13/windows-phone-panorama-versus-pivot-ux-guidelines.aspx

+2
source
 NavigationService.Navigate(new Uri("MainPage.xaml?PivotMain.SelectedIndex = 0", UriKind.Relative)); 

index goes 0-1-2-3 ... write which one you want to move.

0
source

If you dynamically create support elements, you can use this simple code:

 // This find object named as customName object pvtItm = pivotName.FindName("customName"); // If this object has type of PivotItem, navigate to it if (pvtItm is PivotItem) { pivotName.SelectedItem = pvtItm; } 
0
source

All Articles