I have a WPF App in which i have to open a new WPF window on a button click asynchronously as it takes a while due to long running process.
I tried to create a Task an tried to open Window on Task.Run(). But that gives me an exception that it must be an STA operation and requires all UI Components.
After searching i found that u cannot do UI related operation in Task.Run() as it is Multi-Threaded Apartment operation.
Some suggested to create a new Thread for creating a new WPF window.
So, I would like to know how to achieve this and best way for this? Shall i create a new Thread or it can be done via Task?
Regards
Shailesh Aggarwal