I have created a MainPage with two links. Both will take the user to a new Pivot page. However, the first link will open the first page of the Pivot, while the second will open the second page of the Pivot.
I have the following code so far:
MainPage:
NavigationService.Navigate(new Uri("/PivotTester.xaml?goto=" + i, UriKind.Relative));
and then on PivotTester page:
namespace CelticNow
{
public partial class PivotTester : PhoneApplicationPage
{
PivotTester pivot = new PivotTester();
public PivotTester()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
string strItemIndex;
if (NavigationContext.QueryString.TryGetValue("goto", out strItemIndex))
pivot.SelectedIndex = Convert.ToInt32(strItemIndex);
base.OnNavigatedTo(e);
}
}
}
I added in the "Pivot pivot = new..." as using PivotTester.SelectedIndex wouldn't work.
Can anyone provide a solution as to how I would make this work? Thanks.
This will help you, Remove below line of code from your code
EDIT
Make changes in your xaml