views:

224

answers:

2

I have WPF ListBox that shows a lot of data. I need smooth scrolling, so I've set ListBox.ScrollViewer.CanContentScroll to False that disables virtualization. Now when I open tab where this ListBox is placed, I see nothing for few seconds because ListBox is loading/creating items/rendering. I also have a control that shows some animation that indicates that application is running and user should wait a bit. How can I show this control while ListBox is not available?

A: 

Clean shutdown in Silverlight and WPF applications

Check how the author of this application did it via code maybe it can help you though it is different scenario.

abmv
+1  A: 

Add a Grid in the location of your list box and place inside it your ListBox and your animation control. This way they are placed in the same location. The animation control should be on the top of the z-order and so displayed. Once the ListBox has finished loading you would then hide the animation control and so the ListBox would show instead. Any time you need to perform another long operation you set the animation control to visible again.

Phil Wright
How to determine that listbox has already rendered? And rendering is performed in the same thread that "animates" animation, so there won't be any effect. Or I'm not right? I'm already using this technique, but when I need to show that some long background (that works in another thread) operation (non-gui) is in progress.
levanovd