Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void BtnThread_Click(object sender, RoutedEventArgs e)
- {
- thread = new Thread(new ThreadStart(ThreadLoop));
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- }
- public void ThreadLoop()
- {
- DateTime? dtdebTemp = new DateTime();
- DateTime? dtfinTemp = new DateTime();
- DataGrid dg = new DataGrid();
- DataGridTextColumn col = new DataGridTextColumn();
- col.Header = "test";
- Application.Current.Dispatcher.Invoke(new Action(() =>
- {
- dtdebTemp = dtDeb.Value;
- dtfinTemp = dtFin.Value;
- dg = MyDataGridOfMainThread;
- }));
- dg.Columns.Add(col);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement