Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show some animation while control is rendering?

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 the 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?

like image 317
levanovd Avatar asked Nov 25 '09 12:11

levanovd


1 Answers

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.

like image 93
Phil Wright Avatar answered Oct 13 '22 09:10

Phil Wright