无限长列表选择器

时间:2014-04-22 19:17:15

标签: c# .net windows-phone-8

我想实现无限滚动到webclient uri下载。但我找不到长列表选择器的工作示例。

目前我的longlistselector列出了有限数量的结果,如果我可以实现php页面来查询我如何在Windows手机中执行此操作?

1 个答案:

答案 0 :(得分:0)

看看这个sample from Microsoft。这是一个推特无限滚动的例子。

在示例中,他们侦听ItemRealized事件以从viewmodel加载更多项目。然后,viewmodel将项添加到可观察集合的末尾。

void resultListBox_ItemRealized(object sender, ItemRealizationEventArgs e) 
    { 
        if (!_viewModel.IsLoading && resultListBox.ItemsSource != null &&  

resultListBox.ItemsSource.Count

  

= _offsetKnob)               {                   if(e.ItemKind == LongListSelectorItemKind.Item)                   {                       if((e.Container.Content as
  TwitterSearchResult).Equals(resultListBox。   ItemsSource [resultListBox.ItemsSource.Count - _offsetKnob]))                       {                           Debug.WriteLine(“正在搜索{0}”,_ pageNumber);                           _viewModel.LoadPage(_ searchTerm,_ pageNumber ++);                       }                   }               }           }

相关问题