C# How to change UI control from other thread (WinForms and WPF)

WinForms:
public delegate void updateTextBoxDelegate(String textBoxString);  
public updateTextBoxDelegate updateTextBox; 

void updateTextBox1(string str ) { textBox1.Text = str1; } 

void display( string strItem ) 
{
         Form1.Invoke( Form1.updateTextBox, strItem ); 
}


WPF:
tempWindow.Dispatcher.BeginInvoke(new Action(delegate()
                    {
tempWindow.ChangeControlMethod();
                    }));

No comments:

Post a Comment