Posted By

qrist0ph on 10/24/08


Tagged

thread WPF


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

umang_nine
khouser
ovuncgursoy


Manipulate GUI from another Thread


 / Published in: C#
 

  1. private void Button_Click(object sender, RoutedEventArgs e)
  2. {
  3. Thread t= new Thread(new ThreadStart(tuwas));
  4. t.Start();
  5. }
  6.  
  7. public void tuwas()
  8. {
  9. this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
  10. {
  11. myStackPanel.Children.Add(new Button());
  12. }));
  13. }

Report this snippet  

You need to login to post a comment.