.Net Data-Bound Controls


September 9, 2008   .Net — Tags: , , — 52coding    

Most of the controls that ship with.NET Framework support data binding to some degree, because they all inherit from the Control base class, which implements the IBindableComponent interface. That interface defines the contract for supporting a collection of simple binding objects (instances of the Binding class) through a DataBindings collection on the component that implements the interface.

The interface also allows the implementing component to be associated with a BindingContext, which helps keep components that are bound to the same data source synchronized with changes in that data source. More complex controls can also add their own support for more advanced forms of data binding by exposing additional data-binding properties at the control level, such as a DataSource, DataMember, DisplayMember, or ValueMember property.

If the controls that ship with.NET Framework don’t meet your needs, you have a number of options that let you still take advantage of data binding. You could

  • Design your own controls, derived from the Control base class directly or indirectly. At a minimum, your control will inherit these simple data-binding capabilities because it will inherit the implementation of IBindableComponent.

  • Add your own complex data-binding properties to support whatever additional forms of data binding you want.

  • Derive a control from the built-in controls, such as a DataGridView, and inherit all the rich data-binding features already present in that control, while specializing or modifying its behavior to your needs.

  • Get more low level and implement IBindableComponent yourself on any component on which you want to be able to data bind the properties.

  • Turn to the rich market of third-party components available for .NET. These provide specialized behaviors that are intended to save you significant development time for more advanced, but common, data-binding and presentation scenarios.

Technorati : , ,
Del.icio.us : , ,
Zooomr : , ,
Flickr : , ,

Related Articles

  • Random Articles