Creating a window from a new thread in WPF app with no main window?

Well, first of all, you need a dedicated UI thread. Usually it's the initial application thread, but you can take any. (It must be an STA thread.).

Well, first of all, you need a dedicated UI thread. Usually it's the initial application thread, but you can take any. (It must be an STA thread.) Next, you start a dispather in that thread (Dispatcher.

CurrentDispatcher. Run). Next, you can post commands to that thread using Dispatcher.

Invoke or Dispatcher.BeginInvoke. Finally, you can post to your thread window. Show for your custom Window class.

I followed your advice and it seems to have done the trick. One thing that was missing is that I had to pass a reference to the dispatcher (this. Dispatcher) to the background thread.Also... once the new window is closed, it exits the entire application.

I'm still trying to figure that one out. – bshacklett Nov 17 at 15:14 @bshacklett: Well, for the first problem you could save your dispatcher in a static global variable, it's a singleton anyway. For the problem of exiting, you should look at your settings: (1) check that your application has shutdown mode not "on main window close"?(2) check that your worker threads are not background threads (the background threads don't keep the application alive).

– Vlad Nov 18 at 14:20 Got it. Thanks! – bshacklett Nov 21 at 17:40 @bshacklett: you're welcome!

– Vlad Nov 21 at 18:25.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions