I am unable to update a textbox on my user interface from a different thread.
The code that starts the thread is:
private void fileButton_Click(object sender, RoutedEventArgs e)
string filename = "filename.ext";
Thread t = new Thread(() => SendFile(filename));
Then in the SendFile function I try to update the ui:
private void SendFile(string filename)
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Send, new UpdateUiTextDelegate(WriteData), "filename is "+ filename);
and the code for the WriteData function is:
private void WriteData(string text)
Am i trying to do the correct thing? the program works, but the text "filename is ..." does not display on the screen. However the rest of the SendFile function (code is omitted in the function shown) works fine.