The contract is defined by the IWeatherService interface, which exposes an operation named GetWeatherData. This operation accepts an array of cities and returns an array of WeatherData objects that represent the high and low forecasted temperature for a city.
The data binding occurs on the client in the Windows Forms application. A DataGridView, which is a graphical representation of the data, is defined in the Windows Forms Designer. An intermediary named BindingSource is also created. The data source of the BindingSource is set to the data array that is returned by the service. The purpose of the BindingSource is to provide a layer of indirection between the data and the data view. All interaction with the data, such as navigating, sorting, filtering, and updating, is done by using calls to the BindingSource component. To accomplish data binding to the DataGridView, the data source of the DataGridView is then set to the BindingSource object. All of the data returned from the WCF service is then displayed graphically to the user. Every time the user clicks the button, the returned data is automatically updated in the data-bound DataGridView.