12.4. Summary

 < Day Day Up > 

Data binding is used to link the data displayed in a control with an underlying data source. In many cases, it can eliminate the manual code required to populate controls. There are two basic types of binding: simple and complex. Simple is used with controls that display only one value; complex is used to display multiple data values in selected controls such as a list box or data grid.

Each data source has a binding manager that keeps track of all connections to it. This manager is responsible for synchronizing values in the data store and controls bound to it. For list data sources such as an array or data table, the binding manager is a CurrencyManager object; for a property on an object, the binding manager is a PropertyManger object. Both of these objects expose methods that allow them to be used to navigate through their data source.

Of the data bound controls, the DataGridView offers the richest interface. It permits data to be displayed and manipulated in a grid format. Style classes and appearance properties enable almost all of its features to be customized. Its event members allow virtually any action involving the grid to be detected from a click on a cell to the addition of a row. It also permits control types such as a button, image, or ComboBox to be inserted into any of its cells. Although data binding is typically used to populate a DataGridView, the control also supports a virtual mode that allows an application to manage the grid's content using a custom data cache.

     < Day Day Up > 


    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net