📜  如何使用线程 wpf 更改窗口中的某些内容 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:52.544000             🧑  作者: Mango

代码示例1
private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        new Thread(DoSomething).Start();
    }
    public void DoSomething()
    {
        for (int i = 0; i < 100000000; i++)
        {
               this.Dispatcher.Invoke(()=>{
               textbox.Text=i.ToString();
               });    
        } 
    }