WPF System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it

前端 未结 3 2004
滥情空心
滥情空心 2021-01-12 15:28

In my Windows I have a TextBox which I like to update (text property) from another thread. When doing so, I get the InvalidOperationException (see title). I have found diffe

3条回答
  •  时光说笑
    2021-01-12 16:14

    Window1.MyWindow.informationTextBox.Dispatcher.Invoke(
        DispatcherPriority.Normal,
        new Action(() => Window1.MyWindow.informationTextBox.Text += value));
    

提交回复
热议问题