列表框项目动态负载 [英] Listbox items dynamic load

查看:103
本文介绍了列表框项目动态负载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建动态负载在Silverlight列表框的项目。

I want to create dynamic load for items in Silverlight Listbox.

当用户达到由滚动条(或鼠标滚轮)项目的结束,那么我想呼吁下一个10(或不同)项新的请求。

When user reaches end of items by scroll bar (or mouse wheel), then I want call new request for next 10 (or some different) items.

和问题是事件的列表框可以处理这个?

And problem is which event on listbox can handle this?

推荐答案

有很多在Silverlight 3的用户界面虚拟化的进步,但我不认为有什么简单的方法来实现这种类型的数据虚拟化的基础上滚动的列表框。

There were a lot of advances for UI virtualization in Silverlight 3, but I don't think there is any easy method to achieve this type of data virtualization based on scrolling for the ListBox.

一个可能的解决方案是将继承ListBox和处理LayoutUpdated事件来获得访问内部的ScrollViewer。然后,您可以访问垂直滚动条针对的ScrollViewer和寄存器来处理ValueChanged事件。如果滚动条值发生变化,这是在其最大的价值(滚动一路下跌),然后你可以要求你的下一组项目,并把它们添加到底层集合的列表框。

One possible solution would be to subclass ListBox and handle the LayoutUpdated event to get access to the internal ScrollViewer. You can then access the vertical ScrollBar for that ScrollViewer and register to handle the ValueChanged event. If the ScrollBar value changed and it is at its maximum value (scrolled all the way down), you could then request your next set of items and add them to the underlying collection for the ListBox.

看看这个<一href="http://weblogs.manas.com.ar/spalladino/2008/07/02/paging-in-data-bound-listbox-in-silverlight/"相对=nofollow>博客文章的想法。不知道这是最好的方法,但它似乎是可能的工作的解决方案。

Check out this blog post on the idea. Not sure if it is the best approach, but it seems to be a solution that might work.

这篇关于列表框项目动态负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆