简体   繁体   English

在列表框控件中显示无限项(XAML Windows Phone)

[英]Displaying infinite Items in a Listbox control (XAML Windows Phone)

I am making an E-Shopping app for Windows Phone platform. 我正在为Windows Phone平台制作一个电子购物应用程序。 I'm stuck at a place where I need to display all the Search result Found after user input has been recorded. 我被困在记录用户输入后需要显示所有“搜索结果”的地方。 The issue arising is that , only the Products of the 1st Search Result page(as in the Website) get displayed. 出现的问题是,仅显示“第一搜索结果”页面(如网站)中的产品。 I need to load and display all the Products of the search term. 我需要加载并显示搜索词的所有产品。

You can check the XAML CODE I'm using in the following link, and please tell what I need to add in it to display ALL the results instead of being limited to 1 page only. 您可以在以下链接中查看我正在使用的XAML代码,请告诉我需要添加哪些内容以显示所有结果,而不仅限于一页。

http://social.msdn.microsoft.com/Forums/en-US/4a85be6c-5e46-4815-8163-931d1584e363/load-infinite-items-in-a-listbox?forum=wpdevelop http://social.msdn.microsoft.com/Forums/zh-CN/4a85be6c-5e46-4815-8163-931d1584e363/load-infinite-items-in-a-listbox?forum=wpdevelop

You should use LongListSelector as ListBox depreciated. 您应该使用LongListSelector作为已淘汰的ListBox。

Here is an explanation of How to create Infinite Scroll in a LongListSelector. 是有关如何在LongListSelector中创建无限滚动的说明。

Basically you will be adding a definite number of items in LongListSelector as the user scrolls down to the end of the list. 基本上,随着用户向下滚动到列表的末尾,您将在LongListSelector中添加一定数量的项目。

Did you check your xml/json response that the items on the Page 2 is downloaded to your app? 您是否检查了将第2页上的项目下载到您的应用程序的xml / json响应? I think you are missing out some params in your web api call. 我认为您在网络api调用中缺少一些参数。

Because In general, a web api call doesnot provide all items at once, only we have to fetch in some pattern continiously. 因为通常,Web api调用不会一次提供所有项目,所以只需要我们以某种方式连续获取即可。

You can achieve that using LongListSelector ItemRealized Event. 您可以使用LongListSelector ItemRealized Event来实现。 Here is a detailed sample, I checked its perfectly working 这是一个详细的示例,我检查了它的正常工作

http://www.damirscorner.com/InfiniteScrollingWithIncrementalLoadingInWindowsPhone8.aspx http://www.damirscorner.com/InfiniteScrollingWithIncrementalLoadingInWindowsPhone8.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM