BindingSource
Wisej.Web.BindingSource
Last updated
Was this helpful?
Wisej.Web.BindingSource
Last updated
Was this helpful?
Namespace: Wisej.Web
Assembly: Wisej.Framework (2.2.0.0)
Encapsulates the data source for a data-bound component.
Initializes a new instance of the class to the default property values.
Initializes a new instance of the class and adds the to the specified container.
container
Initializes a new instance of the class with the specified data source and data member.
dataSource
dataMember
The specific column or list name within the data source to bind to.
Throws:
Throws:
Negative values are treated as 0.
This option fixes a long standing "feature" of the default BindingSource where the property that is the source of a value change is not refreshed automatically after it updates the bound data source. In a scenario where the data source "transforms" the value received from a data-bound control, the source property is not updated while all other bound properties are.
item
Sorts the data source using the specified property descriptor and sort direction.
property
sort
Sorts the data source with the specified sort descriptions.
sorts
Cancels the current edit operation.
Removes all elements from the list.
item
array
The destination array.
index
The index in the destination array at which to start the copy.
Applies pending changes to the underlying data source.
Returns the index of the item in the list with the specified propertyName and value .
propertyName
The name of the property to search.
value
The value of the item with the specified propertyName to find.
Throws:
Searches for the index of the that has the given value in the specified property .
property
value
The value of the property to match.
Throws:
listAccessors
Returns the name of the list supplying data for the binding operations.
listAccessors
dataMember
The name of column or list, within the data source to retrieve the currency manager for.
item
item to locate.
index
Index at which to insert the item.
item
Item to insert, it can be null.
Throws:
item
Item to remove.
index
Index of the item to remove.
Throws:
metadataChanged
true if the schema has changed; false if only the data has changed.
itemIndex
The index of the item that has changed.
Resumes data binding.
Suspends data binding to prevent changes from updating the data-bound data source.
Provides custom binding management for components.
The to add the current to.
The data source for the .
: Returns whether items in the underlying list can be edited.
: Returns or sets whether the method can be used to add items to the list.
This property is set to true when the underlying list represented by the property has a fixed size or is read-only.
The property is set to true and the event is not handled when the underlying list type does not have a default constructor.
: Returns whether the items can be removed from the underlying list.
: Returns the total number of items in the underlying list, filtered using the current value.
: Returns the currency manager associated with this .
: Returns the current item in the list.
Use the property to access the current item, but use the property to get the entire list. To determine the type of the current object, use the , or methods. To change the current item, set the property to a new integral value, or use one of the navigation methods such as .
: Returns or sets the list in the data source to which the connector currently binds to.
If the contains multiple lists (or tables) of data, you should set the property to the name of one of the sources. Setting this property raises the event
: Returns or sets the data source that the connector binds to.
The property can be set to a number of data sources, including types, objects, and lists of types. The resulting data source will be exposed as a list. The following table shows some of the common data sources and the resulting list evaluation.
| DataSource | List Result | | :--- | | null | An empty of objects. Adding an item sets the list to the type of the added item. | | null with set | Not supported, raises . | | Non-list type or object of type "T" | Empty of type "T". | | instance | containing the array elements. | | instance | An containing the items. | | List instance containing type "T" | instance containing type "T". |
In addition, can be set to other list types such as and and the will handle them appropriately. In this case, the type contained in the list should have a parameterless constructor. When setting a data source, if the supplied reference contains more than one list or table, you must set the property to a string that specifies the list to bind to. Setting this property raises the event.
: Returns or sets the expression used to filter the items in the underlying .
Typically used in complex data-binding scenarios, the property allows you to view a subset of the . Only underlying lists that implement the interface support filtering. When is not null, the passes this property to the underlying list. If you set this property during object initialization, the call will be deferred until after initialization is complete. To form a filter value, specify the name of a column followed by an operator and a value to filter on. The accepted filter syntax depends on the underlying data source. If the underlying data source is a , , or , you can specify Boolean expressions using the syntax documented for the DataColumn.Expression property. The value of the Filter property affects the value of the property. Additionally, the Filter value will persist when the data source changes. To stop filtering the , call the RemoveFilter method.
: Returns whether data binding is suspended.
: Returns whether the underlying has a fixed size.
: Return whether the underlying is read-only.
: Returns whether the items in the underlying are sorted.
: Returns whether access to the collection is synchronized (thread safe).
: Returns or sets the list element at the specified index in the underlying .
index is less than zero or is equal to or greater than .
: Returns the underlying data list.
The class uniformly handles different data sources. Ideally the property should be set to a general . However, sometimes it may be necessary to cast this property to a more specific type. The following table shows the underlying list type, which depends on the type or value of the data source.
| DataSource Type | Underlying List Description | | :--- | | and are null | An empty . | | is null, but is not null | None; an attempt to get the List will throw an . | | An instance | An . | | An instance | The return value from a call to the GetList() method of this instance. | | An instance | An . | | An instance | An . | | A non- instance of type "T" | A with one element. | | An instance | An with one element. | | An | An with the elements copied over. | | The type with of item type "T" | A . | | A Type that represents an or | An instance created by a call to the CreateInstance(Type) method of the class. A may be thrown. | | The type with of item type "T" or a non- type | A | | The type | None; an attempt to get the will throw an . |
If the type retrieved is the interface, the underlying collection may be more complex, such as an or class.
: Returns or sets the index of the current item in the underlying .
When setting the property, out-of-range values are treated in the following manner:
Values greater than or equal to are treated as Count minus 1.
Changing the property will adjust the property.
: Returns or sets a value indicating whether events should be raised.
When the property is false, it suspends the raising of the events. This event indicates that the bound list has been modified in some way, including adding, deleting, inserting, or modifying items.
: Enables the automatic refresh of the source property after a data-bound value has been updated in the data source.
: Returns or sets the column names used for sorting, and the sort order for viewing the rows in the data source.
The property is a case-sensitive string that specifies the column names used to sort the rows, along with the . Columns are sorted ascending by default. Multiple columns can be separated by commas, such as "State, ZipCode DESC". To support sorting, the underlying must implement the or interfaces. This capability can be queried through the property. Multicolumn sorting is available when the property is true. Setting the Sort property will change the internal list depending on its type:
If the list is of type , the and properties are set in the internal list.
If the list is of type , the property is set.
The internal list's sort properties are only changed when the sort string is not null. The get accessor for this property will not retrieve the sort value of the internal list; instead, it will return the set accessor value. The value of the property will persist when the data source changes.
: Returns the collection of sort descriptions applied to the data source.
If the data source is not an , the property always returns null.
: Returns the direction the items in the underlying are sorted.
If the data source is not an , the property always returns .
: Returns the that is being used for sorting the underlying .
If the data source is not an , the property always returns null.
: Returns whether the data source supports multi-column sorting.
If the data source is not an , the property always returns false.
: Return whether the data source supports change notification.
: Returns whether the data source supports filtering.
If the data source is not an , the property always returns false.
: Returns whether the data source supports searching with the method.
If the data source is not an , the property always returns false.
: Returns whether the data source supports sorting.
If the data source is not an , the property always returns false.
: Returns an object used to synchronize access to the underlying .
Adds an existing item to the underlying .
Item to add the underlying .
Returns: . The index at which the item was added to the underlying .
Adds a new item to the underlying .
Returns: . The object that was created and added to the underlying .
A that describes the property by which to sort the data source.
A indicating how the list should be sorted.
The implements single column sorting using a to indicate a property to sort by and a indicating whether the property contents should be sorted in ascending or descending order. Throws:
The data source is not an .
A containing the sort descriptions to apply to the data source.
implements multi-column sorting as a set of property descriptor-direction pairs. Throws:
The data source is not an .
Determines whether the item is present in he underlying .
Item to locate in the underlying .
Returns: . true if the item is found in the .
Copies the contents of the to the specified array , starting at the specified index value.
When the method is called, all pending changes are applied to the underlying data source. This method has no effect unless the objects contained by the data source implement the interface. If the objects do not implement the interface, changes to the data are copied to the underlying data source immediately after each change. This method raises the event.
Returns: . The zero-based index of the item with the specified propertyName and value .
The underlying list is not a with searching functionality implemented.
propertyName does not match a property in the list.
The to search.
Returns: . The index of the item that has the given value .
propertyName does not match a property in the list.
Retrieves an enumerator for the underlying .
Returns: . An for the .
Retrieves an array of objects representing the bindable properties of the data source list type.
An array of objects to find in the type.
Returns: . An array of objects that represents the properties on this list type used to bind data.
An array of objects to find in the list as bindable.
Returns: . The name of the list supplying the data for binding operations.
Returns the related for the specified data member.
Returns: . The related for the specified data member.
Returns the index of the specified item in the underlying .
Returns: . The index of the first occurrence of item in the .
Inserts an item into the at the specified index .
index is less than zero or greater than .
The list is read-only or has a fixed size.
Moves the current position to the first item in the .
Moves the current position to the last item in the .
Moves the current position to the next item in the .
Moves the current position to the previous item in the .
Removes the specified item from the .
Removes the item at the specified index from the .
Removes the current item from the .
Removes the filter associated with this
Removes the sort information associated with this .
The underlying data source does not support sorting.
Causes a control bound to this to re-read all the items and refresh their displayed value.
Causes a control bound to this to re-read the current item and refresh the displayed value.
Causes a control bound to this to read the item at the specified itemIndex and refresh the displayed value.
Fired before an item is added to the underlying .
Fired when all the clients have been bound to this .
Occurs when the currently bound item changes.
Occurs when a property value of the property has changed.
Fired when a currency-related exception is silently handled by the .
Fired when the property value has changed.
Fired when the property value has changed.
Fired when the underlying changes or an item in the list changes.
Fired after the value of the property has changed.