Binding Manager
If you'd want to allow the user to navigate back and forth through the available rows using "Next" and "Back" buttons, the controls will need to be synchronized so tath they display the correct data from the current row.
We use a binding manager that derives from the abstract BindingMangerBase class.
The binding manager enables greater control over data being displayed by bound controls which are bound to the same data source by maintaining the current position of the row pointer. Whenever a data source evaluates a list of data elements, the binding manager supervises and keeps track of the ordinal position of the current row in the data source. The binding manager also fires events to notify the application if the current position in the data source has changed.
Two fundamental properties of a binding manager are Position and Current.
Position is a zero-based integer value that desribes an ordinal position of the rows being read in the data source. With the Position property, you can programmatically advance the row pointer to move onto the next row and vice versa.
Current property returns the data object at the current position in the data source.
Two concrete binding managers are CurrencyManager and PropertyManager
CurrencyManager
CurrencyManager is specifically designed for data sources that implements the IList, ILIstSource and IBindingList (or based on it), such as Array, DataSet and DataTable.
PropertyManager
PropertyManager on the other hand is returned for data source that’s neither a list nor a collection but is a single property of another object or is a single value. (You can use it only for maintaining the Current property of the object since using Position makes no sense as there’s only one value.)
Creating an Instance
You can’t create an instance of a BindingManagerBase because it is an abstract base class. To obtain instances to its derived class, call the BindingContext property of a Windows form, which returns an instance of the appropriate binding manager type, depending on the type of data source being used.
Every Windows form groups all bindings defined by its child controls into a collection called BindingContext. This collection returns an appropriate binding manager for the specified data source and data member.
We use a binding manager that derives from the abstract BindingMangerBase class.
The binding manager enables greater control over data being displayed by bound controls which are bound to the same data source by maintaining the current position of the row pointer. Whenever a data source evaluates a list of data elements, the binding manager supervises and keeps track of the ordinal position of the current row in the data source. The binding manager also fires events to notify the application if the current position in the data source has changed.
Two fundamental properties of a binding manager are Position and Current.
Position is a zero-based integer value that desribes an ordinal position of the rows being read in the data source. With the Position property, you can programmatically advance the row pointer to move onto the next row and vice versa.
Current property returns the data object at the current position in the data source.
Two concrete binding managers are CurrencyManager and PropertyManager
CurrencyManager
CurrencyManager is specifically designed for data sources that implements the IList, ILIstSource and IBindingList (or based on it), such as Array, DataSet and DataTable.
PropertyManager
PropertyManager on the other hand is returned for data source that’s neither a list nor a collection but is a single property of another object or is a single value. (You can use it only for maintaining the Current property of the object since using Position makes no sense as there’s only one value.)
Creating an Instance
You can’t create an instance of a BindingManagerBase because it is an abstract base class. To obtain instances to its derived class, call the BindingContext property of a Windows form, which returns an instance of the appropriate binding manager type, depending on the type of data source being used.
Every Windows form groups all bindings defined by its child controls into a collection called BindingContext. This collection returns an appropriate binding manager for the specified data source and data member.
