Easy:
MainWindow.myInstance.Dispatcher.BeginInvoke(new Action(delegate() {MainWindow.myInstance.myTextBox.Text = "some text";});
WHERE MainWindow.myInstance is the public static variable set for the MainWindow instance (must be set in the constructor and will be null until an instance is created).
It’s good that a lot on one line allows me to go through it:
If you want to update the user interface control, you, as you say, must do this from the user interface thread. There is a built-in way to pass a delegate (method) to the user interface stream: Dispatcher. I used MainWindow.myInstance, which (like all user interface components) contains a link to the Manager - you can also save the link to the Manager in your variable:
Dispatcher uiDispatcher = MainWindow.myInstance.Dispatcher;
Once you have the dispatcher, you can either Invoke () BeginInvoke () pass the delegate to run in the user interface thread. The only difference is that Invoke () will only return after the delegate is started (i.e., in your case, TextBox Text was installed), while BeginInvoke () will return immediately, so your other thread you're calling from is can continue (Dispatcher will start your delegate soon, as it can probably be anyway).
I passed the anonymous delegate above:
delegate() {myTextBox.Text = "some text";}
The bit between {} is the method block. This is called anonymous because only one is created and it does not have a name, but I could create an instance of the delegate:
Action myDelegate = new Action(UpdateTextMethod); void UpdateTextMethod() { myTextBox.Text = "new text"; }
Then passed this:
uiDispatcher.Invoke(myDelegate);
I also used the Action class, which is a built-in delegate, but you could create your own - you can learn more about delegates on MSDN, as this is a little off topic.