I am refactoring my program to use Parallel.ForEach. Before, when I was using a regular for loop, I was updating a WPF progress bar using Dispatcher, displaying the % completed by dividing the current array index by the array size. With a parallel foreach loop this does not display properly i.e. % jumps eratically, which is expected.
How can I update a WPF progress bar from a parallel for each loop so I can track the number of completed iterations?