Skip to content

clsBindableCollectionBase

clsBindableCollectionBase is an abstract base class that implements System.ComponentModel.IBindingList over System.Collections.CollectionBase, so subclass collections can be bound to WinForms/WebForms data-bound controls (grids, list controls) with add/edit/remove/sort/find support hooks.

Purpose

  • Provide a reusable IBindingList implementation over CollectionBase so subclasses do not need to re-implement the binding-list contract themselves.

Context

  • Namespace: SAIF.Framework
  • Assembly/package: SAIF.BOF.Framework.Bindable.csproj (packed into the SAIF.BOF.Framework NuGet package)*
  • Base class / interfaces: System.Collections.CollectionBase, System.ComponentModel.IBindingList

Public members

Member Signature Purpose
ListChanged event ListChangedEventHandler ListChanged Serialization-safe ([NonSerialized]) event raised when the collection's contents change.
AddNew object AddNew() Explicit IBindingList implementation; adds a new item to the collection.
AllowEdit bool AllowEdit Explicit IBindingList implementation; reports whether items can be edited.
AllowNew bool AllowNew Explicit IBindingList implementation; reports whether new items can be added.
AllowRemove bool AllowRemove Explicit IBindingList implementation; reports whether items can be removed.
SupportsSearching bool SupportsSearching Explicit IBindingList implementation; reports search support.
SupportsSorting bool SupportsSorting Explicit IBindingList implementation; reports sort support.
SupportsChangeNotification bool SupportsChangeNotification Explicit IBindingList implementation; always returns true.
Find int Find(PropertyDescriptor property, object key) Explicit IBindingList implementation; delegates to the protected IBindingList_Find extension point.
AddIndex void AddIndex(PropertyDescriptor property) Explicit IBindingList implementation; no-op.
RemoveIndex void RemoveIndex(PropertyDescriptor property) Explicit IBindingList implementation; no-op.
ApplySort void ApplySort(PropertyDescriptor property, ListSortDirection direction) Explicit IBindingList implementation; delegates to the protected IBindingList_ApplySort extension point.
RemoveSort void RemoveSort() Explicit IBindingList implementation; delegates to the protected IBindingList_RemoveSort extension point.
IsSorted bool IsSorted Explicit IBindingList implementation; delegates to the protected IBindingList_IsSorted extension point.
SortDirection ListSortDirection SortDirection Explicit IBindingList implementation; delegates to the protected IBindingList_SortDirection extension point.
SortProperty PropertyDescriptor SortProperty Explicit IBindingList implementation; delegates to the protected IBindingList_SortProperty extension point.

Behavioral notes

  • Protected control flags AllowNew, AllowEdit, AllowRemove, AllowSort, AllowFind all default to false, so a subclass must override these to permit the corresponding operation from a data-bound control.*
  • The On*Complete overrides (OnInsertComplete, OnClearComplete, OnRemoveComplete, OnSetComplete) are invoked automatically by the underlying CollectionBase machinery in response to collection mutations, and each raises OnListChanged with the corresponding ListChangedType.
  • The protected m_CriteriaObject field (Object) mirrors the same field found in clsBindableBase; its intended relationship to the SAIF BOF Criteria/IBusinessCriteria pattern is inferred but not confirmed by any code in this library.*
  • Protected virtual extension points intended for subclass override include OnAddNew(), IBindingList_Find(...), IBindingList_IsSorted, IBindingList_SortProperty, IBindingList_SortDirection, IBindingList_ApplySort(...), and IBindingList_RemoveSort().
  • No consumers of this class exist within this library's own source; actual subclassing usage is outside this library's scope and unverified.**

Constraints and usage notes

  • Subclasses that need full data-bound-grid support (adding, editing, removing, sorting, or finding rows) must override the relevant Allow* flags and protected IBindingList_* extension points; the base implementation is conservative by default (all flags false, index operations are no-ops).
  • The ListChanged event is marked [NonSerialized], so it is excluded from binary/XML serialization of the subclass instance.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Framework.Bindable\clsBindableCollectionBase.cs