I\'m having some trouble making the progress bar show the updates in real time.
This is my code right now
for (int i = 0; i < 100; i++)
{
pr
If you are using .NET 4.5 or later, you can use async/await:
var progress = new Progress(value => progressBar.Value = value);
await Task.Run(() =>
{
for (int i = 0; i < 100; i++)
{
((IProgress)progress).Report(i);
Thread.Sleep(100);
}
});
You need to mark your method with async keyword to be able to use await, for example:
private async void Button_Click(object sender, RoutedEventArgs e)