I started a WPF application on a thread of my main application.
Now I want to access a text box in this WPF application from the main thread.
I was trying to use dispatchers but I could not figure out a way.
Here is my code
class program
{
public static event MyEventHandler event1;
static Application a;
static void fun()
{
a = new Application();
a.StartupUri = new Uri("MainWindow.xaml", System.UriKind.Relative);
//a.initializeComponent();
a.Run();
}
//[STAThread]
static void Main(string[] args)
{
Thread newThread = new Thread(new ThreadStart(fun));
newThread.SetApartmentState(ApartmentState.STA);
newThread.Start();
Trace.WriteLine("rest");
//I WANT TO ACCESS THE TEXT BOX FROM HERE
}
}