I want to update a TextBox
from another thread in a WPF application. Normally, in WinForms, I would use InvokeRequired
, but that is not available here now. When looking around I found this solution:
class SomeClass {
private textBox_Log;
public SomeClass(TextBox tb) {
textBox_Log = tb;
}
public Log(string m) {
Dispatcher.Invoke(() => {
textBox_Log.Text += m + "\n";
});
}
}
but that complains about the Dispatcher
not being available.
How can I update that TextBox
from another thread (to be precise, the call originates from an event handler triggered in a FileSystemWatcher
).