David Brunelle
David Brunelle

Reputation: 6450

Control that load 'as shown' in WPF

I currently have a listview which contains a lot of data. Most of the data, when loaded, isn't shown on screen and the user need to scroll down to see the informations.

The actuel data loading from the database is pretty quick, less then a second when I try to load the whole database content. The display, however, takes a little more time and , of course, takes more time as the number of rows gets bigger, which can become a nuisance, especially on slower computers.

I was wondering if there was some control in WPF that would load the display when the user scroll down in order to balance the loading time (and only load when really needed). I wouldn't mind sometime with pages (like pages 1 of 10 displayed on top or bottom), but something 'seemless' would be quite better I believe.

Thanks

Upvotes: 0

Views: 144

Answers (1)

Steve
Steve

Reputation: 6424

I think a VirtualizingStackPanel is what you might be looking for.

From the MSDN page on it:

The standard layout system creates item containers and computes layout for each item associated with a list control. The word "virtualize" refers to a technique by which a subset of user interface (UI) elements are generated from a larger number of data items based on which items are visible on-screen. Generating many UI elements when only a few elements might be on the screen can adversely affect the performance of your application. The VirtualizingStackPanel calculates the number of visible items and works with the ItemContainerGenerator from an ItemsControl (such as ListBox or ListView) to create UI elements only for visible items.

Upvotes: 1

Related Questions