views:

85

answers:

1

I am using some 3rd party components that take some time (~3-5s) to render - after profiling I've come to conclusion that most of the time is wasted in MeasureOverride and Render methods of those controls... I cannot edit source code of those components. The problem is .. can I display a busy indicator while the interface is being 'drawn' ? Is it possible in WPF?

A: 

No you can't, well, not in a good way.

The UI thread is busy rendering - drawing the busy indicator would require that same thread to draw the indicator instead.

Now, you can create a second window (maybe semi-transparent) from another thread and place that window on top of your frozen window, but that is very difficult to get right, you have to deal with things like the user moving the window (and you will never know the window moved because the thread that accept the move notifications is busy) or other application poping up between your two windows

Also this is likely to interfere with the first window drawing and generally just has to many corner cases to ever get right.

Nir