Simple Multithreading example in .NET and WPF
March 28th, 2010After lots of googling, trying to figure out how to multithread properly in .NET and modify a WPF GUI from another thread, I’ve finally figured a lot of stuff out. I have created a simple multithreading example project in Visual C# 2008 Express.
You can download the project here, but since I know most people just want to get some quick answers, here’s a few code snippets:
This following is a member method of a WPF Window.
The following is an example of a member method of a WPF window that runs itself in a separate thread.
The project file contains more examples, including handling multithreaded events, how to create custom delegates, getting thread states, and intelligently killing threads when the program shuts down.
7 comments
RSS feed for comments on this post.

Nice work David.
Multi-threaded programming is yummy! Omnomnom!
You now need to find something to program using threads on your multi-core, hyperthreading machine…
Mr. R
haha, thanks. I use multithreading in my two main projects, Arcadia and (soon to be renamed) Roomie
Dispatcher.CheckAccess() is a better way so you don’t have to compare the thread yourself
Thanks, Steve! Unfortunately I don’t have any formal C# training, since most classes at my university is either Java or C/C++. I appreciate your insight.
Thank
hi David
after i download it and try to open with winzip
it fails. can you send me it to zbalbel@gmail.com
thank you
Oops, Sorry, Raz. My download service was broken, and I didn’t notice! It’s fixed now.