I have a WPF application using PRISM. I have a login screen and on successfuly logging in a new view containing a TileListView with many items appears. This needs over 10 seconds to render because control has to calculate a lot etc. All this uses the UI thread by standard behaviour, because rendering in WPF is done in UI thread. Is it possible to display a WaitControl like a spinner or just a simple animation in seperate window or something like this? Now to animation stops at the time, the control is rendered in UI Thread.
You could create a new window that launches in a separate thread. Please refer to the following blog post for an example of how to do this.
Launching a WPF Window in a Separate Thread: http://reedcopsey.com/2011/11/28/launching-a-wpf-window-in-a-separate-thread-part-1/
Then you just start this thread that displays the window just after you have validated the credentials and just before your heavy rendering is about to begin.
This is probably the best thing you can do and it should also be a pretty easy thing to implement.
you can use SplashScreen to display untill the background process is completed. Refer this Splash Screen in WPF
来源:https://stackoverflow.com/questions/42698192/wait-screen-during-rendering-uielement-in-wpf