This article can help you to understand the proper usages of threading in WPF.
IntroductionThreading enables a program to do concurrent processing so that it can do more than one operation at a time. Window Presentation Foundation (WPF) has been designed such that it saves the developer from the difficulties of threading. This article can help you to understand the proper use of threading in WPF.WPF Internal threads and rulesAll WPF applications run with a minimum of the following two threads:
WPF supports a single-threaded apartment model that has the following rules:
Thread handling in WPF by developerWhen creating an application in WPF the developer must sometimes manage the threads, so it provides some way to handle and use the thread in the application on various scenarios. The following are the two ways for handling the threads:
The DispatcherThe Dispatcher is an instance of the System.Windows.Threading.Dispatcher class. It owns the application thread and manages a queue of work items. It executes UI operations in a First in First Out (FIFO) manner by taking priority of each. It does not create a new thread. It is not multi-threaded.Every Visual WPF object derives from a DispatcherObject. It is an object that is linked to the DispatcherObject class. The following are the members of the DispatcherObject class:
Why do we need Dispatcher?An example that will clarify the need of Dispatcher in WPF Application:
BackgroundWorker is a class under System.ComponentModel. It executes the operation on a separate thread.
Pro WPF: Windows Presentation Foundation in .NET 3.0