Show TOC

Models and Data BindingLocate this document in the navigation structure

Data binding is used to bind two data sources or information sources together and to keep them in synch. Model instances hold the data and provide the methods required to set the data or to retrieve data from a server.

If data binding is implemented and defined properly, all changes in one data source are automatically reflected in the other data source. Usually, the UI uses data binding to bind UI controls to a data source that holds the application data, so that the controls are updated automatically whenever application data is changed. The model provides the method for creating bindings to the data. When this method is called, a data binding instance is created, which contains the binding information and provides an event, which is fired whenever the bound data is changed. An element can listen to this event and update its visualization according to the new data.

The term data binding is also used when changes in the control cause updates in the underlying application data, such as data being entered by a user. This is called bi-directional binding or two-way binding.

A Web application should support several data sources, such as JSON, XML, Atom, or OData. However, the way in which data binding is defined and implemented within the UI controls should be independent of the respective data source. It should also be possible to create a custom model implementation for data sources that are not yet covered by the framework or are domain-specific.