Create another Modern Window in a new STA Thread

May 30, 2013 at 8:36 AM
I already have a main window(Modern window), I want to create another window in a new STA thread.But I get the error
"cannot access freezable Shell.WindowChrome across threads bec it cannot be frozenause"
I use Dispatcher to create the window, up error solved. but antother problem is
"The calling thread can not accress the object because another thread own it"

I want to know could I create another modern window in a new STA thread?
For traditional window It is OK.

Thank you very much
May 30, 2013 at 9:03 AM
My Code as follow:
private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        Thread thread = new Thread(new ThreadStart(
            delegate()
            {
                ModernWindow theView = new ModernWindow();
                theView.Closed += (viewsender, viewe) => theView.Dispatcher.InvokeShutdown();
                theView.Show();
                Dispatcher.Run();
            }));
        thread.SetApartmentState(ApartmentState.STA);
        thread.Name = "ChildThread";
        thread.IsBackground = true;
        thread.Start();
    }
Coordinator
Jun 3, 2013 at 9:58 PM
Good question. I can reproduce, but I do not know why this fails. Creating a Window instead of ModernWindow works just fine.
Nov 11, 2014 at 6:27 PM
Do we have a fix for this issue yet? I am currently trying to do the same as Pagina, and getting the same error as well.