System.Windows.Forms
1.0.5000.0
2.0.0.0
System.Object
System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ListBindingConverter))
Use the class to create and maintain a simple binding between the property of a control and either the property of an object, or the property of the current object in a list of objects.
As an example of the first case, you can bind the property of a control to the FirstName property of a Customer object. As an example of the second case, you can bind the property of a control to the FirstName property of a that contains customers.
The class also enables you to format values for display through the event and to retrieve formatted values through the event.
When constructing a instance with constructor, you must specify three items:
-
The name of the control property to bind to.
-
The data source.
-
The navigation path that resolves to a list or property in the data source. The navigation path is also used to create the object's property.
First, you must specify name of the control property you want to bind the data to. For example, to display data in a control, specify the property.
Second, you can specify an instance of any one of the classes in the following table as the data source.
-
Description
C# example
-
Any class that implements or . These include the following: , , , or .
DataSet ds = new DataSet("myDataSet");
-
Any class that implements to create an indexed collection of objects. The collection must be created and filled before creating the . The objects in the list must all be of the same type; otherwise, an exception will be thrown.
ArrayList ar1 = new ArrayList;
Customer1 cust1 = new Customer("Louis");
ar1.Add(cust1);
-
A strongly typed of strongly typed objects
Customer [] custList = new Customer[3];
Third, you must specify the navigation path, which can be an empty string (""), a single property name, or a period-delimited hierarchy of names. If you set the navigation path to an empty string, the method will be called on the underlying data source object.
If the data source is a , which can contain multiple objects, the navigation path must be used to resolve to a specific column.
When the data source is a , , or , you are actually binding to a . Consequently, the bound rows are actually objects.
A period-delimited navigation path is required when the data source is set to an object that contains multiple objects (such as a or ). You can also use a period-delimited navigation path when you bind to an object whose properties return references to other objects (such as a class with properties that return other class objects). For example, the following navigation paths all describe valid data fields:
-
"Size.Height"
-
"Suppliers.CompanyName"
-
"Regions.regionsToCustomers.CustomerFirstName"
-
"Regions.regionsToCustomers.customersToOrders.ordersToDetails.Quantity"
Each member of the path can return either a property that resolves to a single value (such as an integer), or a list of values (such as an array of strings). Although each member in the path can be a list or property, the final member must resolve to a property. Each member builds on the previous member: "Size.Height" resolves to the property for the current ; "Regions.regionsToCustomers.CustomerFirstName" resolves to the first name for the current customer, where the customer is one of the customers for the current region.
A returns a list of values by linking one to a second in a . If the contains objects, you can specify the data member as a followed by a , and then a . For example, if the named "Suppliers" contains a named "suppliers2products", the data member could be "Suppliers.suppliers2products.ProductName".
The data source can consist of a set of related classes. For example, imagine a set of classes that catalogs solar systems. The class named System contains a property named Stars that returns a collection of Star objects. Each Star object has Name and Mass properties, as well as a Planets property that returns a collection of Planet objects. In this system, each planet also has Mass and Name properties. Each Planet object further has a Moons property that returns a collection of Moon objects, each of which also has Name and Mass properties. If you specify a System object as the data source, you can specify any of the following as the data member:
-
"Stars.Name"
-
"Stars.Mass"
-
"Stars.Planets.Name"
-
"Stars.Planets.Mass"
-
"Stars.Planets.Moons.Name"
-
"Stars.Planets.Moons.Mass"
Controls that can be simple-bound feature a collection of objects in a , which you can access through the control's property. You add a to the collection by calling the method, thereby binding a property of the control to a property of an object (or to a property of the current object in a list).
You can simple-bind to any object that derives from the class, for example, the following Windows controls:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Only the property of the , , and control is simple bound.
The class is an abstract class that manages all the objects for a particular data source and data member. Classes that derive from are the and the classes. How a is managed depends on whether the is a list binding or a property binding. For example, if it is a list binding, you can use the to specify a in the list; the , therefore, determines which item (out of all items in the list) is actually bound to a control. To return the appropriate , use the .
To add a new row to a set of controls bound to the same , use the method of the class. Use the property of the class to return the appropriate . To escape the addition of the new row, use the method.
Represents the simple binding between the property value of an object and the property value of a control.
Constructor
You can specify an instance of any of the following classes for the data source:
-
-
-
-
-
-
Any class that implements the interface
-
Any class
See the class for more information about creating the string.
When you create a binding to a control's property, the new inspects the events exposed by the bound control and attaches to two particular events:
-
-
An event named PropertyNameChanged (for example, )
If you attempt to bind to a property that does not exist, an will be thrown when the is added to the control's collection.
Initializes a new instance of the class that simple-binds the indicated control property to the specified data member of the data source.
The name of the control property to bind.
An that represents the data source.
The property or list to bind to.
1.0.5000.0
2.0.0.0
Constructor
2.0.0.0
To be added.
Initializes a new instance of the class that binds the indicated control property to the specified data member of the data source, and optionally enables formatting to be applied.
The name of the control property to bind.
An that represents the data source.
The property or list to bind to.
true to format the displayed data; otherwise, false.
Constructor
2.0.0.0
You can specify an instance of any of the following classes for the data source:
-
-
-
-
-
-
Any class that implements the interface
-
Any class
See the class for more information about creating the string.
When you create a binding to a control's property, the new inspects the events exposed by the bound control and attaches to two particular events:
-
.
-
An event named PropertyNameChanged (for example, )
Initializes a new instance of the class that binds the specified control property to the specified data member of the specified data source. Optionally enables formatting and propagates values to the data source based on the specified update setting.
The name of the control property to bind.
An representing the data source.
The property or list to bind to.
true to format the displayed data; otherwise, false.
One of the values.
Constructor
2.0.0.0
You can specify an instance of any of the following classes for the data source:
-
-
-
-
-
-
Any class that implements the interface
-
Any class
See the class for more information about creating the string.
When you create a binding to a control's property, the new inspects the events exposed by the bound control and attaches to two particular events:
-
-
An event named PropertyNameChanged (for example, )
Initializes a new instance of the class that binds the indicated control property to the specified data member of the specified data source. Optionally enables formatting, propagates values to the data source based on the specified update setting, and sets the property to the specified value when a is returned from the data source.
The name of the control property to bind.
An representing the data source.
The property or list to bind to.
true to format the displayed data; otherwise, false.
One of the values.
The to be applied to the bound control property if the data source value is .
Constructor
2.0.0.0
You can specify an instance of any of the following classes for the data source:
-
-
-
-
-
-
Any class that implements the interface
-
Any class
See the class for more information about creating the string.
When you create a binding to a control's property, the new inspects the events exposed by the bound control and attaches to two particular events:
-
-
An event named PropertyNameChanged (for example, )
Initializes a new instance of the class that binds the specified control property to the specified data member of the specified data source. Optionally enables formatting with the specified format string; propagates values to the data source based on the specified update setting; and sets the property to the specified value when a is returned from the data source.
The name of the control property to bind.
An representing the data source.
The property or list to bind to.
true to format the displayed data; otherwise, false.
One of the values.
The to be applied to the bound control property if the data source value is .
One or more format specifier characters that indicate how a value is to be displayed.
Constructor
2.0.0.0
You can specify an instance of any of the following classes for the data source:
-
-
-
-
-
-
Any class that implements the interface
-
Any class
See the class for more information about creating the string.
When you create a binding to a control's property, the new inspects the events exposed by the bound control and attaches to two particular events:
-
-
An event named PropertyNameChanged (for example, )
Initializes a new instance of the class with the specified control property to the specified data member of the specified data source. Optionally enables formatting with the specified format string; propagates values to the data source based on the specified update setting; enables formatting with the specified format string; sets the property to the specified value when a is returned from the data source; and sets the specified format provider.
The name of the control property to bind.
An representing the data source.
The property or list to bind to.
true to format the displayed data; otherwise, false.
One of the values.
The to be applied to the bound control property if the data source value is .
One or more format specifier characters that indicate how a value is to be displayed.
An implementation of to override default formatting behavior.
Property
2.0.0.0
System.ComponentModel.DefaultValue(null)
System.Windows.Forms.IBindableComponent
To be added.
To be added.
Gets the control the is associated with.
Event
2.0.0.0
System.Windows.Forms.BindingCompleteEventHandler
This event is raised under any of the following conditions when is true:
-
Data from the data source is pushed onto the control property.
-
Data from the control property is pushed onto the data source.
This event is raised at the completion of these operations, independent of the completion status. For example, if a binding operation binds a null value to a property, an exception is thrown, but the event still occurs. The handler of this event can take the appropriate action, based on the success, error, or exceptions in the binding process, by examining the property of the parameter.
For more information about handling events, see Consuming Events.
Occurs when the property is set to true and a binding operation is complete, such as when data is pushed from the control to the data source or vice versa
Property
System.Windows.Forms.BindingManagerBase
To be added.
Use the to iterate through a data-bound list by incrementing or decrementing the property. The class is abstract. The class, which manages data-bound lists, inherits from the class.
Gets the for this .
1.0.5000.0
2.0.0.0
Property
System.Windows.Forms.BindingMemberInfo
To be added.
The is created from the string passed to the constructor.
Gets an object that contains information about this binding based on the parameter in the constructor.
1.0.5000.0
2.0.0.0
Property
System.ComponentModel.DefaultValue(null)
System.Windows.Forms.Control
To be added.
To be added.
Gets the control that the binding belongs to.
1.0.5000.0
2.0.0.0
Property
2.0.0.0
System.ComponentModel.DefaultValue(System.Windows.Forms.ControlUpdateMode.OnPropertyChanged)
System.Windows.Forms.ControlUpdateMode
To be added.
To be added.
Gets or sets when changes to the data source are propagated to the bound control property.
Property
System.Object
To be added.
Possible data sources include:
-
A
-
A
-
A
-
A
-
Any object that implements the interface
-
Any object
Gets the data source for this binding.
1.0.5000.0
2.0.0.0
Property
2.0.0.0
System.Object
To be added.
You can use the property to specify the value displayed in a bound control when the data source contains .
Gets or sets the value to be stored in the data source if the control value is null or empty.
Property
2.0.0.0
System.ComponentModel.DefaultValue(System.Windows.Forms.DataSourceUpdateMode.OnValidation)
System.Windows.Forms.DataSourceUpdateMode
To be added.
Note that even if this property is set to , the binding will update at least one time, when it is first established.
Gets or sets a value that indicates when changes to the bound control property are propagated to the data source.
Event
System.Windows.Forms.ConvertEventHandler
The event is raised when data is pushed from the data source into the control. You can handle the event to convert unformatted data from the data source into formatted data for display. When data is pulled from the control into the data source, the event is raised to unformat the displayed value, then the event occurs to reformat the data for display. This ensures that the bound control displays correctly formatted data regardless of whether the user enters formatted or unformatted data in the control.
The and events allow you to create custom formats for displaying data. For example, if the data in a table is of type , you can display the data in the local currency format by setting the property of the to the formatted value in the event. You must consequently unformat the displayed value in the event.
The event occurs whenever the value of the changes, which includes:
-
The first time the property is bound.
-
Any time the changes.
-
Whenever the data-bound list is sorted or filtered, which is accomplished when a supplies the list.
The event also occurs after the event. For example, when a control loses focus, its contents are parsed. Immediately afterward, as new data is pushed into the control, the event occurs allowing the new contents to be formatted.
For more information about handling events, see Consuming Events.
Occurs when the property of a control is bound to a data value.
1.0.5000.0
2.0.0.0
Property
2.0.0.0
System.ComponentModel.DefaultValue(null)
System.IFormatProvider
To be added.
Setting this property will override the default formatting behavior, which uses the property setting.
Gets or sets the that provides custom formatting behavior.
Property
2.0.0.0
System.String
To be added.
The format string used should follow standard .NET Framework format specifications. For more information, see Formatting Overview.
Gets or sets the format specifier characters that indicate how a value is to be displayed.
Property
2.0.0.0
System.ComponentModel.DefaultValue(false)
System.Boolean
To be added.
Setting this property to true also enables error-handling behavior and causes the event to be raised. The handler of this event can take the appropriate action, based on the success, error, or exceptions in the binding process, by examining the property of the parameter.
Gets or sets a value indicating whether type conversion and formatting is applied to the control property data.
Property
System.Boolean
To be added.
A binding is active when it meets these conditions:
-
All its properties are set.
-
The user did not call or on the that the belongs to.
-
The control to which the belongs has been created.
Gets a value indicating whether the binding is active.
1.0.5000.0
2.0.0.0
Property
2.0.0.0
System.Object
To be added.
The data source must contain for the property to be correctly applied. If the data source type is a type such as a string or integer the value of the property will be ignored. Also, the property is ignored if it is set to null.
A null value will be added to the data source when the control property is set to the object of . If is set to a string value, comparisons are case-insensitive.
Gets or sets the to be set as the control property when the data source contains a value.
Method
2.0.0.0
System.Void
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Raises the event.
A that contains the event data.
Method
System.Void
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Raises the event.
A that contains the event data.
1.0.5000.0
2.0.0.0
Method
System.Void
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Raises the event.
A that contains the event data.
1.0.5000.0
2.0.0.0
Event
System.Windows.Forms.ConvertEventHandler
The and events allow you to create custom formats for displaying data. For example, if the data in a table is of type , you can display the data in the local currency format by setting the property of the to the formatted value in the event. You must consequently unformat the displayed value in the event.
The event occurs under the following conditions:
-
After the event of the occurs.
-
When the method of the is called.
-
When the of the changes (in other words, when the changes).
For more information about handling events, see Consuming Events.
Occurs when the value of a data-bound control changes.
1.0.5000.0
2.0.0.0
Property
System.ComponentModel.DefaultValue("")
System.String
To be added.
Use the to specify the control property that you want to bind to a list in a data source. Most commonly, you bind a display property such as the property of a control. However, because you can bind any property of a control, you can programmatically create controls at run time using data from a database.
Gets or sets the name of the control's data-bound property.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.Void
To be added.
Sets the control property to the value read from the data source.
Method
2.0.0.0
System.Void
To be added.
Reads the current value from the control property and writes it to the data source.