I'm trying to update my WPF GUI from another thread. I've found some solutions with using the Dispatcher but it's still not working.
For example I'm using it in a catch block:
catch (Exception err){
Dispatcher.BeginInvoke((Action)(() => {
pConsole.AppendText(err.Message);
pConsole.ScrollToEnd();
}));
return;
}
pConsole is a RickTextBox.
With the dispatcher there is an output at the pConsole, but the output is:
The calling thread cannot access this object because a different thread owns it.
Any idea what's wrong?
pConsole.Dispatcher(see example here) ?Application.Current.Dispatcher.pConsole.DispatcherandApplication.Current.Dispatcherandthis.Dispatcher.Invoke(() => { pConsole.AppendText(err.Message); pConsole.ScrollToEnd(); });. Unfortunately it's the same result on all of them.