如何在Windows Phone 8的列表框中添加页脚

时间:2013-09-06 06:36:18

标签: windows-phone-8 listbox footer

我正在做一个Windows Phone 8应用程序。在这个我用过列表框。对于第一页,我从服务器获取数据并将该数据添加到列表框中。现在我想在列表框的底部添加显示更多,即在最后一项之后,从服务器获取下一个项目。

我怎么能实现这个目标?

3 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

 we can Gets or sets the amount of data to fetch for virtualizing/prefetch operations by using 
 ListViewBase.DataFetchSize property and can Initiates the asynchronous request to load more data items, in accordance with the active incremental loading settings by ListViewBase.LoadMoreItemsAsync method.

If you want to do it by pagination then the following links may be helpfull for you
 DataFetchSize method 

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.listviewbase.datafetchsize.aspx

LoadMoreItemsAsync method: 

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.listviewbase.loadmoreitemsasync.aspx

You can see examples of using these here (though note that the sample was based on Windows 8 BUILD release and the apis have had some changes)

http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/e71b7036-4fb7-4963-a65d-5bcb9fd8f664

答案 2 :(得分:0)

我将继续发布逻辑,因为我的代码可能与您的代码不匹配

所以

1 - >将服务器数据保存在数组或列表中。 2 - >以父网格有两行或更多行的方式设计xaml,最后一行显示更多。列表之前的那个。 (相应调整高度) 3 - >使用有限数量的数据填充它。 4 - >接下来使用ListBox.Items.Add(data)方法将数据添加到列表中。保持已排序的属性,以便元素插入列表的底部   - >点击链接Add Method for Observable Collections

在显示更多按钮上使用第四步点击..并调整列表的高度或将其放入滚动查看器,以便可以进行有限高度滚动。如果进一步查询,请更新