First lets start with how to get started with multithreading in WPF.
If you don’t want to read how this actually works and just want to get the source and start playing ,here is the Source Code.
Make sure you set the Worker Reports Progess property of the Background Worker to true.
Now if you find a discrepancy in my walk-through, please comment.
But I tried to comment like crazy the code so you can get through it.
Input; using MVVM; namespace WPFProgress Bar Using Background Worker I’m sorry that this is not the most Newbie proof post.
I can’t count the number of times someone has asked me about running a time consuming task on a separate thread, but at the same time show a progress dialog with up-to-the-second percentage updates being displayed to the user.
You are going to see when it is OK to use the foreground and when it is not OK but better to use Background Worker.
While much of this code may be production ready, you should be aware that this code intentionally implements a foreground process that is an example of what not to do.
Multithreading can be confusing at first, but if you just take it one step at a time, it really isn’t all that bad.
I am going to show you how to create a multithreaded application that shows a progress dialog which shows real time progress to the user.
Reporting the Progress of a Background Process You can report the progress of a background process back to the primary thread by calling the Report Progress method.