如何在windows phone 8的列表框中添加页脚

Posted

技术标签:

【中文标题】如何在windows phone 8的列表框中添加页脚【英文标题】:How to add footer to the list box in windows phone 8 【发布时间】:2013-09-06 06:36:18 【问题描述】:

我正在做一个 windows phone 8 应用程序。在此我使用了列表框。对于第一页,我从服务器获取数据并将该数据添加到列表框中。现在我想在列表框底部(即最后一项之后)添加 Show More,以从服务器获取下一项。

我怎样才能做到这一点?

【问题讨论】:

【参考方案1】:

听说你必须使用水平滚动来加载下一个数据

查看以下教程

Detect when a ListBox scrolls to its end (WP7)

Windows phone tutorial:Listbox

WP7 – How To Extend ListBox When Reaching Last Item

Windows Phone 7 ListBox Pagination with MVVMLight & ApplicationBar

【讨论】:

【参考方案2】:
 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

【讨论】:

【参考方案3】:

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

所以

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

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

【讨论】:

以上是关于如何在windows phone 8的列表框中添加页脚的主要内容,如果未能解决你的问题,请参考以下文章

无法连续两次从列表框中选择相同的项目 - windows phone 8 C#

windows phone 8 长列表选择器。如何在长列表选择器中添加新项目。目前我正在使用 ItemRealized 事件

Windows Phone 7 - 在列表框中切换开关

如何填充文本框-Windows Phone 8.1

如何从列表框绑定 Windows Phone 7 中选择一个项目

如何在 Windows Phone 8.1 的列表视图中更新 <image> 的图像