As mentioned in comments you must use BackgroundWorker.ReportProgress Method to update your UI elements...
WPF update textbox while backgroundworker is running
-
30-03-2022 - |
Question
I am trying to continuously update my TextBox
while the BackgroundWorker
is running.
The code I am using freezes my application:
worker.RunWorkerAsync();
int i = 1;
while (worker.IsBusy)
{
myTextBox.Text = i;
i++;
System.Threading.Thread.Sleep(2000);
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow