Which code segment should you recommend for the main page?

You are designing a Windows Phone 7 application that contains a Pivot page. The Pivot page contains the following code.
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) {
int index = Convert.ToInt32(NavigationContext.QueryString[“index”]); pivot1.SelectedIndex = index;
base.OnNavigatedTo(e);
}
You need to ensure that navigation between the main page and the Pivot page works without runtime errors.
Which code segment should you recommend for the main page?

You are designing a Windows Phone 7 application that contains a Pivot page. The Pivot page contains the following code.
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) {
int index = Convert.ToInt32(NavigationContext.QueryString[“index”]); pivot1.SelectedIndex = index;
base.OnNavigatedTo(e);
}
You need to ensure that navigation between the main page and the Pivot page works without runtime errors.
Which code segment should you recommend for the main page?

A.
NavigationService.Navigate(new Uri(“/PivotPage1.xaml?index=0”, UriKind.Absolute));

B.
NavigationService.Navigate(new Uri(“/PivotPage1.xaml?index=0”, UriKind.Relative)); NavigationContext.QueryString.Add(“index”, “0”);

C.
NavigationService.Navigate(new Uri(“/PivotPage1.xaml”, UriKind.RelativeOrAbsolute)); NavigationContext.QueryString.Add(“index”, “0”);

D.
NavigationService.Navigate(new Uri(“/PivotPage1.xaml”, UriKind.Relative));



Leave a Reply 0

Your email address will not be published. Required fields are marked *