In the previous recipe, we looked at the best way to run operations in non-UI/background threads in Windows Forms. The concerns that we addressed for Windows Forms exist for WPF as well. You cannot access any control on the UI thread from the background thread. In such a case, how do you pass data to a UI thread? In this recipe, we are going to discuss the best approach to doing this.
MainWindow.xmlin the design mode. Design the UI so that it looks similar to the following screenshot: