I am using the MessageBox provided by WPF Toolkit. And I get the error
The calling thread must be STA, because many UI components require this
new Thread(new ThreadStart(delegate
{
MessageBox.Show("Opeartion could not be completed. Please try again.","Error",MessageBoxButton.OK,MessageBoxImage.Error);
})).Start();
How can I set the ApartmentState in this case
Edit: I am trying to display a modeless MessageBox using MessageBox control of WPF Toolkit. So far the code I have is as follows:
void SomeFunction()
{
// calls to some UI, and processing and then
var th = new Thread(new ThreadStart(delegate
{
MessageBox.Show("Opeartion could not be completed. Please try again.",
"Error", MessageBoxButton.OK, MessageBoxImage.Error);
}));
th.SetApartmentState(ApartmentState.STA);
th.Start();
}
}