levanovd
levanovd

Reputation: 4165

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?

Upvotes: 7

Views: 1038

Answers (2)

abmv
abmv

Reputation: 7108

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.

Upvotes: 0

Phil Wright
Phil Wright

Reputation: 22926

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.

Upvotes: 2

Related Questions