我是一个初学者,正在为 Windows Phone 7.1 创建一个应用程序,我正在尝试通过列表框中的单击事件导航到新页面,基本上我希望列表框中的每个项目都应该导航到不同的页面我已尝试以下代码
private void FirstListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
// If selected index is -1 (no selection) do nothing
if (FirstListBox.SelectedIndex == -1)
return;
// Navigate to the new page
NavigationService.Navigate(new Uri("/FirstItemPage1.xaml?selectedItem=" + FirstListBox.SelectedIndex, UriKind.Relative));
// Reset selected index to -1 (no selection)
FirstListBox.SelectedIndex = -1;
}
上面的代码运行良好,但问题是它将整个列表框带到同一页面,但我希望每个单独的项目导航到不同的页面