項(xiàng)目里有MainWindow.xamlAClass.cs兩個(gè)文件。其中MainWindow里有一個(gè)TextBox一個(gè)Button其中AClass.cs下有一個(gè)Method()方法。publicclassAClass{publicvoidMethod(){stringstr;//要把這個(gè)值傳到主界面并在TextBox上顯示}}//MainWindow.xaml.cs里的BUTTON事件privatevoidButton_Click_1(objectsender,RoutedEventArgse){AClassa=newAClass();ThreadaTh=newThread(newThreadStart(a.Method));aTh.Start();}如何把Method里的str傳到MainWindow.xaml并且在TextBox里顯示?
WPF 如何在子線程里傳值并更新界面UI
翻翻過去那場(chǎng)雪
2019-03-30 09:32:47