Wednesday, 28 September 2011

WPF Deep Dive: Binding

Let’s dive today into WPF binding.

Binding literally means a link or connection between two objects. In WinForms world, binding usually meant fetching data from a database, filling up the DataSet objects and then binding them with the data grid on the visual layer. Although there was the possibility of binding the UI layer to custom business objects – there was little support from the framework to achieve this. We can’t say it was totally absent, because the interface we use in .NET 3.5/4.0 for binding – INotifyPropertyChanged (in System.ComponentModel namespace) has been available since .NET framework 2.0.

Binding in real world:

untitled

Let us begin with wiping out WinForms from our minds. If we want to develop a banking application with the UI given above, what comes to your mind? With our background in OOPS we would start thinking in objects (or if you are designer you would start with selecting a better color for the text :-). Objects we think are a Customer with all properties like name, account no., balance etc.; a Bank object with bank name, a web service to fetch/update customer details.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.