You might want to send the PivotItem
index you want to go to in your navigation pointer (if your Pivot HAS static PivotItem
s)
so you want to go to FIFTH PivotItem
, then you may need to pass the navigation parameter with the PivotItem index (which is 4). On the PivotItem
page PivotItem
you get the index from the passed parameter and select PivotItem
using the SelectedIndex
property
For example, your Pivot
contained in PivotPage.xaml
, then you may want to go to this page how it is done (you, of course, add a navigation call to the event handler with the image):
this.NavigationService.Navigate(new Uri("/PivotPage.xaml?item=4", UriKind.RelativeOrAbsolute));
item=4
- your navigation parameter
Then, in the PivotPage.xaml
code PivotPage.xaml
add an override to the OnNavigateTo()
method of PhoneApplicationPage
, for example:
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (NavigationContext.QueryString.ContainsKey("item")) { var index = NavigationContext.QueryString["item"]; var indexParsed = int.Parse(index); Pivot.SelectedIndex = indexParsed; } }
source share