tags:

views:

172

answers:

3

I'm using a list box where there are on average about 500 thumbnails (items) that can be sorted and searched.

Since I'm using default databinding and search descriptors (which I've heard are slow due to reflection) the list takes a noticeable pause of a few seconds loading, sorting, and searching (the list dynamically updates based on the contents of the search box so the first one or two letters typed are really slow).

I don't think I can fully do away with reflection give the timeframe for the project, and speed isn't super essential, but I'd like some kind of graphical indication of the delay so it doesn't confuse the user. How could I do something like a website video loading screen where the listbox grays out and some kind of loading circle indicates it's processing until the list is ready? Or even just grayed out with the words "Loading..." for a few seconds could work. Any ideas?

Thanks in advance for your help and suggestions!!!

A: 

Silverlight-Controlkit comes with a very handy "busyindicator"-control... too bad there seems to be no such thing for WPF by default.

But I found this seemfully comparable control for you: http://sweux.com/blogs/pombeiro/index.php/2009/12/01/a-busy-state-indicator-attached-behavior/

download-source: http://gallery.expression.microsoft.com/en-us/BusyIndicator

Steav
Thanks, I'm going to check this out!
evan
A: 

Try BackgroundWorker

Use the DoWork method to update your list dynamically based on the search keyword Use the ProgressChanged method to update your UI with some animation saying 'Loading'. A ProgressBar could be used

Use Dispatcher to access your list inside the DoWork method

Veer
I'll try to do the search and and sorting inside a background worker and let you know if it get's rid of the lag. Is there a way to super impose a gray/transparent box over the listbox while the worker is working that you know of?
evan
A strokeless black rectangle control with 50% opacity may suit your need.
Veer
Depending on the background color of your window, changing a control's Opacity value to say 0.4 also gives a grayed out look/feel.
Marko
A: 

Like Veer wrote, BackgroundWorker is probably your best bet.

For the graphical indication of progress and/or delay, take a look at

http://www.codeproject.com/KB/WPF/WPF_Loading_Wait_Adorner.aspx

It looks like pretty much exactly what you want to do.

Tendlon