Binding

Wisej.Web.Binding

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.0.0.0)

Represents the simple binding between the property value of an object and the property value of a IBindableComponent.

public class Binding : Binding, IBinding

Constructors

Binding(propertyName, dataSource, dataMember)

Initializes a new instance of the Binding class that simple-binds the indicated control property to the specified data member of the data source.

Name
Type
Description

propertyName

The name of the control property to bind.

dataSource

An Objectarrow-up-right that represents the data source.

dataMember

The property or list to bind to.

Throws:

Binding(propertyName, dataSource, dataMember, formattingEnabled)

Initializes a new instance of the Binding class that binds the indicated control property to the specified data member of the data source, and optionally enables formatting to be applied.

Name
Type
Description

propertyName

The name of the control property to bind.

dataSource

An Objectarrow-up-right that represents the data source.

dataMember

The property or list to bind to.

formattingEnabled

true to format the displayed data; otherwise, false.

Throws:

  • ArgumentExceptionarrow-up-right The property given by propertyName does not exist on the control; or the property given is a read-only property.

  • Exceptionarrow-up-right Formatting is disabled and propertyName is neither a valid property of a control nor an empty string ("").

Binding(propertyName, dataSource, dataMember, formattingEnabled, dataSourceUpdateMode)

Initializes a new instance of the Binding 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.

Name
Type
Description

propertyName

The name of the control property to bind.

dataSource

An Objectarrow-up-right representing the data source.

dataMember

The property or list to bind to.

formattingEnabled

true to format the displayed data; otherwise, false.

dataSourceUpdateMode

One of the DataSourceUpdateMode values.

Throws:

  • ArgumentExceptionarrow-up-right The property given by propertyName does not exist on the control; or the data source or data member or control property specified are associated with another binding in the collection.

Binding(propertyName, dataSource, dataMember, formattingEnabled, dataSourceUpdateMode, nullValue)

Initializes a new instance of the Binding 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 DBNullarrow-up-right is returned from the data source.

Name
Type
Description

propertyName

The name of the control property to bind.

dataSource

An Objectarrow-up-right representing the data source.

dataMember

The property or list to bind to.

formattingEnabled

true to format the displayed data; otherwise, false.

dataSourceUpdateMode

One of the DataSourceUpdateMode values.

nullValue

The Objectarrow-up-right to be applied to the bound control property if the data source value is DBNullarrow-up-right.

Throws:

  • ArgumentExceptionarrow-up-right The property given by propertyName does not exist on the control; or the data source or data member or control property specified are associated with another binding in the collection.

Binding(propertyName, dataSource, dataMember, formattingEnabled, dataSourceUpdateMode, nullValue, formatString)

Initializes a new instance of the Binding 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 DBNullarrow-up-right is returned from the data source.

Name
Type
Description

propertyName

The name of the control property to bind.

dataSource

An Objectarrow-up-right representing the data source.

dataMember

The property or list to bind to.

formattingEnabled

true to format the displayed data; otherwise, false.

dataSourceUpdateMode

One of the DataSourceUpdateMode values.

nullValue

The Objectarrow-up-right to be applied to the bound control property if the data source value is DBNullarrow-up-right.

formatString

One or more format specifier characters that indicate how a value is to be displayed.

Throws:

  • ArgumentExceptionarrow-up-right The property given by propertyName does not exist on the control; or the data source or data member or control property specified are associated with another binding in the collection.

Binding(propertyName, dataSource, dataMember, formattingEnabled, dataSourceUpdateMode, nullValue, formatString, formatInfo)

Initializes a new instance of the Binding 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 DBNullarrow-up-right is returned from the data source; and sets the specified format provider.

Name
Type
Description

propertyName

The name of the control property to bind.

dataSource

An Objectarrow-up-right representing the data source.

dataMember

The property or list to bind to.

formattingEnabled

true to format the displayed data; otherwise, false.

dataSourceUpdateMode

One of the DataSourceUpdateMode values.

nullValue

The Objectarrow-up-right to be applied to the bound control property if the data source value is DBNullarrow-up-right.

formatString

One or more format specifier characters that indicate how a value is to be displayed.

formatInfo

An implementation of IFormatProviderarrow-up-right to override default formatting behavior.

Throws:

  • ArgumentExceptionarrow-up-right The property given by propertyName does not exist on the control; or the data source or data member or control property specified are associated with another binding in the collection.

Properties

BindableComponent

IBindableComponent: Returns the IBindableComponent this Binding is associated with. (Default: null)

BindingMemberInfo

BindingMemberInfo: Return the binding information based on the dataMember parameter in the #ctor constructor.

Control

Control: Returns the control that the binding belongs to. (Default: null)

ControlUpdateMode

ControlUpdateMode: Returns or sets when changes to the data source are propagated to the bound control property. (Default: OnPropertyChanged)

DataSource

Objectarrow-up-right: Returns the data source for this binding.

DataSourceNullValue

Objectarrow-up-right: Returns or sets the value to be stored in the data source if the control value is null or empty.

DataSourceUpdateMode

DataSourceUpdateMode: Returns or sets a value that indicates when changes to the bound control property are propagated to the data source. (Default: OnValidation)

Events

EventHandlerListarrow-up-right: Returns the list of event handlers that are attached to this Componentarrow-up-right.

FormatInfo

IFormatProviderarrow-up-right: Returns or sets the IFormatProviderarrow-up-right that provides custom formatting behavior. (Default: null)

FormatString

Stringarrow-up-right: Returns or sets the format specifier characters that indicate how a value is to be displayed.

FormattingEnabled

Booleanarrow-up-right: Returns or sets a value indicating whether type conversion and formatting is applied to the control property data. (Default: False)

IsBinding

Booleanarrow-up-right: Returns whether the binding is active.

NullValue

Objectarrow-up-right: Returns or sets the Objectarrow-up-right to be set as the control property when the data source contains a DBNullarrow-up-right value.

PropertyName

Stringarrow-up-right: Returns the name of the control's data-bound property. (Default: "")

Methods

OnBindingComplete(e)

Fires the BindingComplete event.

Parameter
Type
Description

e

A BindingCompleteEventArgs that contains the event data.

OnFormat(e)

Fires the Format event.

Parameter
Type
Description

e

A ConvertEventArgs that contains the event data.

OnParse(e)

Fires the Parse event.

Parameter
Type
Description

e

A ConvertEventArgs that contains the event data.

ReadValue()

Sets the control property to the value read from the data source.

WriteValue()

Reads the current value from the control property and writes it to the data source.

Events

BindingComplete

BindingCompleteEventHandler Fired when the FormattingEnabled property true and a binding operation is completed.

Format

ConvertEventHandler Fired when the property of a control is bound to a data value.

Parse

ConvertEventHandler Fired when the value of a data-bound control changes.

Implements

Name
Description

Defines a component's binding instance.

Last updated

Was this helpful?