I am new to WPF and have a couple of questions about integrating WPF and Windows Forms.
I have an existing Visual C # Windows Forms application. I would like to integrate it with the WPF window, which can be displayed with the click of a button. This was not possible since WPF expects the calling thread to be STAThread, and by default WinForm assumes the thread is MTAThread. I tried to create a new thread with STAThread apartment state to call the WPF interface, but this did not work. I also tried using the Dispatcher.BeginInvoke method and background desktop, but none of them solved the problem.
1) Can we make a WPF window / control call without marking Main as STAThread? If possible, can someone point me in the right direction? 2) If the only way to achieve this is to make the main STAThread thread, will there be any impact on the overall performance / responsiveness of the application.
Thanks in advance.
source
share