Binding a WPF element with data from a WCF service
WPF (Windows Presentation Foundation) is the new UI presentation technology provided since .NET 3.0, and released together with WCF. For client applications that use a WPF-based front UI and consume WCF for data retrieving, it is quite common to display data objects retrieved from a WCF service to a WPF front UI.
In this recipe, we will use a simple WPF window application to demonstrate how to bind WCF service data to WPF UI elements.
How to do it...
Create an XAML-based WPF Window application.
First, we need to create a WPF client application with an XAML-based window as the main user interface. The following screenshot shows the main window of the WPF application.
For this sample case, we will put all the window UI definition within the XAML file so as to make the code focus on data binding functionality. The following screenshot shows the complete XAML template of the main window. The XAML file contains the definition of three main UI elements...