MultiThreading - Opening new window in WPF

0

I would like to know if any of you know how to solve this damn error, (I want to open another window but it gives this error when it starts) = can help?

    
asked by anonymous 12.09.2017 / 02:39

1 answer

0

I do not use more than 1 window for applications, I just use the main window and populate it with usercontrols linked to ViewModels in the MVVM model, but usually when it comes to using different thread you have to use with Dispatcher.Invoke(...)

See my example to change the background color of a message popup (type Toast)

TempBackgroundColor.Dispatcher.Invoke(() => TempBackgroundColor = corfundo);

as mentioned by Anderson Henrique no more information we can not help

A kick in the dark (and without testing anything) I would use something like this:

var w = new Window();
this.Dispatcher.Invoke(() => w.Show());

The this in this case is its MainWindow .

    
17.11.2017 / 18:25