10.6 Summary
Windows Forms provides a very flexible architecture for binding data
sources to control properties. Any property of any object can act as
a data source, and any control can participate. Lists of objects can
also act as data sources, and for these the system will provide a
CurrencyManager object to track the current
position in the list. Certain controls support complex binding, which
means that they are able to display entire lists at a time. There are
also specialized data sources—the DataTable
and DataSet classes allow multiple tables of data
to be held in memory along with information about relations between
those tables. Using these, programs can let the user browse through
substantial sets of data, and selectively display related details
with a minimal number of round trips to the database. Controls bound
to a DataSet or DataTable
always present data as filtered by a DataView. By
default, this will either show the whole table or will just display
rows related to a selected item in a parent table, but it is possible
to build custom views with arbitrary filtering criteria. The
DataGrid control provides highly specialized
support for data binding, allowing all properties of all items in a
table to be displayed, and it can even traverse relations between
multiple tables.
|