I have a very basic problem, which alas, I haven't been able to resolve I have a Window called Login
, which has well, Login logic. When the user authenticates himself, I'm opening the Main Window which in my case is Test
(The naming is bad, I know). The Test
window, is a fairly big window (In terms of UI and Data), and houses a multitude of User Controls which themselves load Datagrids
. Hence as a result, after pressing the login button, the app's UI freezes for some time and then the Test
window appears. I would want to display a progress bar in Login
and want the UI to stay responsive also. How should I achieve this.
Asked
Active
Viewed 54 times
0

Ketan Dubey
- 430
- 8
- 19
-
All UI tasks run on the main thread, if a form load keeps busy the thread you can't do any UI related task meanwhile. – Gusman Aug 02 '17 at 17:03
-
I am ready to use another Thread to open the other window. Can I do this then? – Ketan Dubey Aug 02 '17 at 17:04
-
No, it will crash, you can't interact with the UI from a secondary thread. – Gusman Aug 02 '17 at 17:04
-
I want to get rid of the app freezing, what would you advise me do? Also if I can show some progress that would be great. – Ketan Dubey Aug 02 '17 at 17:07
-
The only way to avoid "freezing" the UI is to do the long-running work in some other thread. See marked duplicate. Note that the UI itself does need to be constructed in the UI thread. You need to construct all the underlying _data_ in the background thread, so it can be bound to the UI in the UI thread. How best to do that depends on the specific details; if you have trouble, post a new question in which you provide a good [mcve] showing what you've tried, and a clear explanation of what _specifically_ you are having trouble with. – Peter Duniho Aug 02 '17 at 17:22