MicTech
MicTech

Reputation: 45053

Listbox items dynamic load

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

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?

Upvotes: 0

Views: 1065

Answers (2)

Dan Auclair
Dan Auclair

Reputation: 3617

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.

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.

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.

Upvotes: 2

Ken Smith
Ken Smith

Reputation: 20445

Start here, with Bea Stolnitz' article on data virtualization in Silverlight.

Upvotes: 1

Related Questions