You may want to send in your navigation args the index of the PivotItem
you want to navigate to (if your Pivot HAS static PivotItem
s)
so you want to navigate to the FIFTH PivotItem
, then you may want to pass a navigation parameter with the index of PivotItem (which is 4). In your PivotItem
page, you will get the index from the passed param and select the PivotItem
using the property SelectedIndex
For example, your Pivot
is contained in PivotPage.xaml
, then you may want to navigate to that page like so (you add the navigation call to the image tap event handler of course):
this.NavigationService.Navigate(new Uri("/PivotPage.xaml?item=4", UriKind.RelativeOrAbsolute));
item=4
is your navigation param
Then in your PivotPage.xaml
code-behind, add an override to OnNavigateTo()
method of PhoneApplicationPage
, like so:
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;
}
}