Is DataBinding Better?

Asking me? Yes it’s better to take advantage of this technology. So why do developers avoid using it in so many cases? Guess it’s because they don’t realize the advantages it comes with, or is it because they don’t know how to use it correctly?

So what are the advantages? Well, if you ask me there are many. First you can start building your user interface by defining the data objects, this way you don’t let the user interface dominate your business model. How to do this:

First you define your data objects:

Data Objects

Build your project…

Then you open your user control on which you wish to map the data object, add a new data source to the project:

  1. Data > Show Data Sources > Add New Data Source…

Add the data object. Now the data object will appear in the data sources panel. Modify the controls to add for the data source by using the drop down at the root (select form if you want to display a detailed view using specific controls). For each member in the data source (you can add user- or 3rd party controls if the implement data binding for the data type) select the specific controls to be used.

Now drag the newly added data source onto a form or user control and you will, depending on how you configured the root element of the data source, get a data grid with auto populated columns or a detailed form view with the controls defined in the data source. The latter is my favorite, and with custom controls implementing data binding its a pleasure building an entire form in just one drag… and drop.

Advertisement

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.