Windows phone 7 无法获取要在“我的详细信息”页面上显示的选定listboxitem
我制作了一个rss阅读器,有一个包含所有提要的列表框。当我选择一个项目并想看整篇文章时,我只得到selectedindex编号,0、1、2等等 这是我的密码:Windows phone 7 无法获取要在“我的详细信息”页面上显示的选定listboxitem,windows-phone-7,listboxitem,Windows Phone 7,Listboxitem,我制作了一个rss阅读器,有一个包含所有提要的列表框。当我选择一个项目并想看整篇文章时,我只得到selectedindex编号,0、1、2等等 这是我的密码: private void feedListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox listBox = sender as ListBox; if (listBox != n
private void feedListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ListBox listBox = sender as ListBox;
if (listBox != null && listBox.SelectedItem != null)
{
NavigationService.Navigate(new Uri("/DetailsPage.xaml?feeditem=" + listBox.SelectedIndex, UriKind.Relative));
}
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string feeditem = "";
if (NavigationContext.QueryString.TryGetValue("feeditem", out feeditem))
{
this.textBlock1.Text = feeditem;
}
}
我错过了什么?老实说,你错过了很多东西。您应该先访问create.msdn.com了解基本的WP7开发。这样做之后,一切都会变得更清晰。你只会得到
SelectedItem
,因为这是你在导航url中添加的参数。我曾在某个时候使用过MVVM,但没有看到它的意义。我修复了很多遗漏的内容。