DekGenius.com
[ Team LiB ] Previous Section Next Section

BindingManagerBase

System.Windows.Forms (system.windows.forms.dll)abstract class

This class represents a mapping of a property (or column) in a data source to a property on a Control. In the case of simple binding, it uses a bag of Binding objects to handle those mappings. For complex data binding, you can derive a class that handles the data-binding process.

Each binding manager maintains a current Position in the data source, to allow multiple bound controls to remain in sync, each control displaying a different column in the same selected row.

For example, a ListBox and a TextBox can be bound to a data source with same binding manager (simple binding for the TextBox providing a Binding object, complex binding for the ListBox without an explicit binding object). The two will remain synchronized as the ListBox selection changes. Another ListBox and TextBox bound to the same data source but through a second binding manager will also remain synchronized with one another, but will not be synchronized with the first pair. (See BindingContext to find out how to create an independent binding manager for your second pair of controls.)

If the current row in the data source changes, the binding manager raises PositionChanged. If the value of the bound object changes, the CurrentChanged event is raised. See CurrencyManager for information about how this works in practice, and Binding for more information about the data-binding hierarchy.

public abstract class BindingManagerBase {
// Public Constructors
   public BindingManagerBase();
// Protected Instance Fields
   protected EventHandler onCurrentChangedHandler;
   protected EventHandler onPositionChangedHandler;
// Public Instance Properties
   public BindingsCollection Bindings{get; }
   public abstract int Count{get; }
   public abstract object Current{get; }
   public abstract int Position{set; get; }
// Public Instance Methods
   public abstract void AddNew();
   public abstract void CancelCurrentEdit();
   public abstract void EndCurrentEdit();
   public abstract PropertyDescriptorCollection GetItemProperties();
   public abstract void RemoveAt(int index);
   public abstract void ResumeBinding();
   public abstract void SuspendBinding();
// Protected Instance Methods
   protected internal virtual PropertyDescriptorCollection GetItemProperties(System.Collections.ArrayList dataSources, 
        System.Collections.ArrayList listAccessors);
   protected virtual PropertyDescriptorCollection GetItemProperties(Type listType, int offset, 
        System.Collections.ArrayList dataSources, System.Collections.ArrayList listAccessors);
   protected internal abstract string GetListName(System.Collections.ArrayList listAccessors);
   protected internal abstract void OnCurrentChanged(EventArgs e);
   protected void PullData();
   protected void PushData();
   protected abstract void UpdateIsBinding();
// Events
   public event EventHandler CurrentChanged;
   public event EventHandler PositionChanged;
}

Subclasses

CurrencyManager, PropertyManager

Returned By

Binding.BindingManagerBase, BindingContext.this

Passed To

BindingContext.AddCore()

    [ Team LiB ] Previous Section Next Section