Chapter 21. Threading

This chapter covers:

  • The Dispatcher
  • Asynchronous calls
  • Timers
  • Making our CIA application more insulting

In Windows Forms, the cardinal rule for threading was that all UI operations had to take place on the same thread—or, at least, on the thread that created the window with which you were working. Although the mechanics are a little bit different, the same exact rule applies to WPF.

WPF has two UI threads: the main UI thread and a rendering thread, which does the real rendering, animation, and so on. But, you can almost never interact with the rendering thread; for practical purposes, you can ignore it. In threading situations, you have to make sure that all your UI calls take place on the main UI thread.

There are a ...

Get WPF in Action with Visual Studio 2008 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.