# BindingExtensions

Namespace: **Wisej.Web.Markup**

Assembly: **Wisej.Framework** (4.0.0.0)

Adds [fluent markup](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/markup/markup) extension methods to the [Control](/api/wisej.web/general/control.md) class.

{% tabs %}
{% tab title="C#" %}

```csharp
public class BindingExtensions
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class BindingExtensions
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TTargetProp, TSource>(component, targetProp, dataSource, sourceProp, formattingEnabled, updateMode, nullValue, formatString, formatProvider, parse, format)

Binds a specified property of a component to a property of a data source.

| Parameter                                              | Type                                                                                                                      | Description                                                                                                                                 |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **TComponent**                                         |                                                                                                                           | The type of the component, which must implement [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md).          |
| **TTargetProp**                                        |                                                                                                                           | The type of the target property on the component.                                                                                           |
| **TSource**                                            |                                                                                                                           | The type of the data source.                                                                                                                |
| **component**                                          | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                                      | The component to bind to.                                                                                                                   |
| **targetProp**                                         | [Expression\<Func\<TComponent, TTargetProp>>](https://docs.microsoft.com/dotnet/api/system.linq.expressions.expression-1) | An expression representing the target property on the component.                                                                            |
| **dataSource**                                         | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                                         | The data source to bind from.                                                                                                               |
| **sourceProp**                                         | [String](https://docs.microsoft.com/dotnet/api/system.string)                                                             | The name of the property on the data source to bind to.                                                                                     |
| **formattingEnabled** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                                           | Indicates whether formatting is enabled. Default is `false`.                                                                                |
| **updateMode** ![](/files/1vGqtbG2j637vQ4ROWOf)        | [DataSourceUpdateMode](/api/wisej.web/data-binding/wisej.web.datasourceupdatemode.md)                                     | Specifies when the data source is updated. Default is [OnValidation](/api/wisej.web/data-binding/wisej.web.datasourceupdatemode.md#fields). |
| **nullValue** ![](/files/1vGqtbG2j637vQ4ROWOf)         | [Object](https://docs.microsoft.com/dotnet/api/system.object)                                                             | The value to be used when the data source value is `null`. Default is `null`.                                                               |
| **formatString** ![](/files/1vGqtbG2j637vQ4ROWOf)      | [String](https://docs.microsoft.com/dotnet/api/system.string)                                                             | The format string to apply. Default is an empty string.                                                                                     |
| **formatProvider** ![](/files/1vGqtbG2j637vQ4ROWOf)    | [IFormatProvider](https://docs.microsoft.com/dotnet/api/system.iformatprovider)                                           | An object that provides culture-specific formatting information. Default is `null`.                                                         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)             | [Func\<Object, TTargetProp>](https://docs.microsoft.com/dotnet/api/system.func-2)                                         | A function to convert the data source value to the target property type. Default is `null`.                                                 |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf)            | [Func\<TTargetProp, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)                                         | A function to convert the target property value to the data source type. Default is `null`.                                                 |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The component with the binding applied.

This method allows for complex data binding scenarios where custom parsing and formatting logic is required.

```csharp

var component = new TextBox();
var dataSource = new { Value = 123 };
component.Bind(c => c.Text, dataSource, "Value", format: v => v.ToString());

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(component, targetProp, dataSource, sourceProp, formattingEnabled, updateMode, nullValue, formatString, formatProvider, parse, format)

Binds a specified property of a component to a data source property with optional formatting and conversion.

| Parameter                                              | Type                                                                                   | Description                                                                                                                                 |
| ------------------------------------------------------ | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **TComponent**                                         |                                                                                        | The type of the component implementing [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md).                   |
| **TSource**                                            |                                                                                        | The type of the data source.                                                                                                                |
| **component**                                          | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)   | The component to bind the property to.                                                                                                      |
| **targetProp**                                         | [String](https://docs.microsoft.com/dotnet/api/system.string)                          | The name of the target property on the component.                                                                                           |
| **dataSource**                                         | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)      | The data source to bind to.                                                                                                                 |
| **sourceProp**                                         | [String](https://docs.microsoft.com/dotnet/api/system.string)                          | The name of the property on the data source to bind to.                                                                                     |
| **formattingEnabled** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                        | Indicates whether formatting is enabled. Default is `false`.                                                                                |
| **updateMode** ![](/files/1vGqtbG2j637vQ4ROWOf)        | [DataSourceUpdateMode](/api/wisej.web/data-binding/wisej.web.datasourceupdatemode.md)  | Specifies when the data source is updated. Default is [OnValidation](/api/wisej.web/data-binding/wisej.web.datasourceupdatemode.md#fields). |
| **nullValue** ![](/files/1vGqtbG2j637vQ4ROWOf)         | [Object](https://docs.microsoft.com/dotnet/api/system.object)                          | The value to use when the data source property is `null`. Default is `null`.                                                                |
| **formatString** ![](/files/1vGqtbG2j637vQ4ROWOf)      | [String](https://docs.microsoft.com/dotnet/api/system.string)                          | The format string to apply. Default is an empty string.                                                                                     |
| **formatProvider** ![](/files/1vGqtbG2j637vQ4ROWOf)    | [IFormatProvider](https://docs.microsoft.com/dotnet/api/system.iformatprovider)        | The format provider to use. Default is `null`.                                                                                              |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)             | [Func\<ConvertEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | A function to convert the data source value to the target property type. Default is `null`.                                                 |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf)            | [Func\<ConvertEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | A function to convert the target property value to the data source type. Default is `null`.                                                 |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The component with the binding applied.

This method is useful for simple data binding scenarios where the target property and data source property types are compatible.

```csharp

var component = new TextBox();
component.Bind("Text", dataSource, "Name");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(grid, columnIndex, dataSource, sourceProp, parse, format)

Binds a specified column of the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) to a data source.

| Parameter                                   | Type                                                                                                      | Description                                                    |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **TComponent**                              |                                                                                                           | The type of the DataGridView component.                        |
| **TSource**                                 |                                                                                                           | The type of the data source.                                   |
| **grid**                                    | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                      | The DataGridView to bind.                                      |
| **columnIndex**                             | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                               | The index of the column to bind.                               |
| **dataSource**                              | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                         | The data source to bind to.                                    |
| **sourceProp**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The property of the data source to bind to the column.         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Func\<DataGridViewCellParsingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)    | Optional. A function to parse cell values. Default is `null`.  |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Func\<DataGridViewCellFormattingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | Optional. A function to format cell values. Default is `null`. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The DataGridView with the specified column bound to the data source.

This method binds a column of the DataGridView to a specified property of the data source.

```csharp

var grid = new DataGridView();
grid.Bind(0, dataSource, "PropertyName");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(grid, columnIndex, dataSource, dataMember, sourceProp, parse, format)

Binds a specified column of the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) to a data source with a data member.

| Parameter                                   | Type                                                                                                      | Description                                                    |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **TComponent**                              |                                                                                                           | The type of the DataGridView component.                        |
| **TSource**                                 |                                                                                                           | The type of the data source.                                   |
| **grid**                                    | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                      | The DataGridView to bind.                                      |
| **columnIndex**                             | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                                               | The index of the column to bind.                               |
| **dataSource**                              | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                         | The data source to bind to.                                    |
| **dataMember**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The data member within the data source to bind to.             |
| **sourceProp**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The property of the data source to bind to the column.         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Func\<DataGridViewCellParsingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)    | Optional. A function to parse cell values. Default is `null`.  |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Func\<DataGridViewCellFormattingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | Optional. A function to format cell values. Default is `null`. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The DataGridView with the specified column bound to the data source.

This method binds a column of the DataGridView to a specified property of the data source, using a data member.

```csharp

var grid = new DataGridView();
grid.Bind(0, dataSource, "DataMember", "PropertyName");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(grid, columnName, dataSource, sourceProp, parse, format)

Binds a specified column of the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) to a data source using the column name.

| Parameter                                   | Type                                                                                                      | Description                                                    |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **TComponent**                              |                                                                                                           | The type of the DataGridView component.                        |
| **TSource**                                 |                                                                                                           | The type of the data source.                                   |
| **grid**                                    | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                      | The DataGridView to bind.                                      |
| **columnName**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The name of the column to bind.                                |
| **dataSource**                              | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                         | The data source to bind to.                                    |
| **sourceProp**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The property of the data source to bind to the column.         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Func\<DataGridViewCellParsingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)    | Optional. A function to parse cell values. Default is `null`.  |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Func\<DataGridViewCellFormattingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | Optional. A function to format cell values. Default is `null`. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The DataGridView with the specified column bound to the data source.

This method binds a column of the DataGridView to a specified property of the data source using the column name.

```csharp

var grid = new DataGridView();
grid.Bind("ColumnName", dataSource, "PropertyName");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(grid, columnName, dataSource, dataMember, sourceProp, parse, format)

Binds a specified column of the [DataGridView](/api/wisej.web/lists-and-grids/datagridview.md) to a data source with a data member using the column name.

| Parameter                                   | Type                                                                                                      | Description                                                    |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **TComponent**                              |                                                                                                           | The type of the DataGridView component.                        |
| **TSource**                                 |                                                                                                           | The type of the data source.                                   |
| **grid**                                    | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                      | The DataGridView to bind.                                      |
| **columnName**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The name of the column to bind.                                |
| **dataSource**                              | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                         | The data source to bind to.                                    |
| **dataMember**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The data member within the data source to bind to.             |
| **sourceProp**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The property of the data source to bind to the column.         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Func\<DataGridViewCellParsingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)    | Optional. A function to parse cell values. Default is `null`.  |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Func\<DataGridViewCellFormattingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | Optional. A function to format cell values. Default is `null`. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The DataGridView with the specified column bound to the data source.

This method binds a column of the DataGridView to a specified property of the data source, using a data member and the column name.

```csharp

var grid = new DataGridView();
grid.Bind("ColumnName", dataSource, "DataMember", "PropertyName");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(grid, column, dataSource, sourceProp, parse, format)

Binds a specified [DataGridViewColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumn.md) to a data source.

| Parameter                                   | Type                                                                                                      | Description                                                    |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **TComponent**                              |                                                                                                           | The type of the DataGridView component.                        |
| **TSource**                                 |                                                                                                           | The type of the data source.                                   |
| **grid**                                    | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                      | The DataGridView to bind.                                      |
| **column**                                  | [DataGridViewColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumn.md)         | The DataGridViewColumn to bind.                                |
| **dataSource**                              | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                         | The data source to bind to.                                    |
| **sourceProp**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The property of the data source to bind to the column.         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Func\<DataGridViewCellParsingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)    | Optional. A function to parse cell values. Default is `null`.  |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Func\<DataGridViewCellFormattingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | Optional. A function to format cell values. Default is `null`. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The DataGridView with the specified column bound to the data source.

This method binds a DataGridViewColumn to a specified property of the data source.

```csharp

var grid = new DataGridView();
var column = grid.Columns[0];
grid.Bind(column, dataSource, "PropertyName");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(grid, column, dataSource, dataMember, sourceProp, parse, format)

Binds a specified [DataGridViewColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumn.md) to a data source with a data member.

| Parameter                                   | Type                                                                                                      | Description                                                    |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **TComponent**                              |                                                                                                           | The type of the DataGridView component.                        |
| **TSource**                                 |                                                                                                           | The type of the data source.                                   |
| **grid**                                    | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                      | The DataGridView to bind.                                      |
| **column**                                  | [DataGridViewColumn](/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewcolumn.md)         | The DataGridViewColumn to bind.                                |
| **dataSource**                              | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)                         | The data source to bind to.                                    |
| **dataMember**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The data member within the data source to bind to.             |
| **sourceProp**                              | [String](https://docs.microsoft.com/dotnet/api/system.string)                                             | The property of the data source to bind to the column.         |
| **parse** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Func\<DataGridViewCellParsingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2)    | Optional. A function to parse cell values. Default is `null`.  |
| **format** ![](/files/1vGqtbG2j637vQ4ROWOf) | [Func\<DataGridViewCellFormattingEventArgs, Object>](https://docs.microsoft.com/dotnet/api/system.func-2) | Optional. A function to format cell values. Default is `null`. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The DataGridView with the specified column bound to the data source.

This method binds a DataGridViewColumn to a specified property of the data source, using a data member.

```csharp

var grid = new DataGridView();
var column = grid.Columns[0];
grid.Bind(column, dataSource, "DataMember", "PropertyName");

```

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(listView, columnName, dataSource, sourceProp)

Binds a data source to a specified column in a ListView.

| Parameter      | Type                                                                                 | Description                                               |
| -------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------- |
| **TComponent** |                                                                                      | The type of the ListView component.                       |
| **TSource**    |                                                                                      | The type of the data source.                              |
| **listView**   | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md) | The ListView component to bind the data source to.        |
| **columnName** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The name of the column to bind the data source to.        |
| **dataSource** | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)    | The data source to bind.                                  |
| **sourceProp** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The property of the data source to display in the column. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The ListView component with the data source bound to the specified column.

This method binds a data source to a specified column in a ListView by setting the column's display property name and assigning the data source to the ListView.

```csharp

var listView = new ListView();
listView.Bind("ColumnName", dataSource, "SourceProperty");

```

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) Thrown when the specified column name does not exist in the ListView.

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(listView, columnName, dataSource, dataMember, sourceProp)

Binds a data source to a specified column in a ListView with a specified data member.

| Parameter      | Type                                                                                 | Description                                               |
| -------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------- |
| **TComponent** |                                                                                      | The type of the ListView component.                       |
| **TSource**    |                                                                                      | The type of the data source.                              |
| **listView**   | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md) | The ListView component to bind the data source to.        |
| **columnName** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The name of the column to bind the data source to.        |
| **dataSource** | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)    | The data source to bind.                                  |
| **dataMember** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The data member of the data source to bind.               |
| **sourceProp** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The property of the data source to display in the column. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The ListView component with the data source bound to the specified column and data member.

This method binds a data source to a specified column in a ListView by setting the column's display property name, assigning the data member, and then assigning the data source to the ListView.

```csharp

var listView = new ListView();
listView.Bind("ColumnName", dataSource, "DataMember", "SourceProperty");

```

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) Thrown when the specified column name does not exist in the ListView.

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(listView, column, dataSource, sourceProp)

Binds a data source to a specified column in a ListView.

| Parameter      | Type                                                                                 | Description                                               |
| -------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------- |
| **TComponent** |                                                                                      | The type of the ListView component.                       |
| **TSource**    |                                                                                      | The type of the data source.                              |
| **listView**   | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md) | The ListView component to bind the data source to.        |
| **column**     | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md)    | The column to bind the data source to.                    |
| **dataSource** | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)    | The data source to bind.                                  |
| **sourceProp** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The property of the data source to display in the column. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The ListView component with the data source bound to the specified column.

This method binds a data source to a specified column in a ListView by setting the column's display property name and assigning the data source to the ListView.

```csharp

var listView = new ListView();
var column = new ColumnHeader();
listView.Bind(column, dataSource, "SourceProperty");

```

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) Thrown when the specified column is null.

### ![](/files/lIX317sDtMTZJBi9oSIx) Bind\<TComponent, TSource>(listView, column, dataSource, dataMember, sourceProp)

Binds a data source to a specified column in a ListView with a specified data member.

| Parameter      | Type                                                                                 | Description                                               |
| -------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------- |
| **TComponent** |                                                                                      | The type of the ListView component.                       |
| **TSource**    |                                                                                      | The type of the data source.                              |
| **listView**   | [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md) | The ListView component to bind the data source to.        |
| **column**     | [ColumnHeader](/api/wisej.web/lists-and-grids/listview/wisej.web.columnheader.md)    | The column to bind the data source to.                    |
| **dataSource** | [TSource](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md)    | The data source to bind.                                  |
| **dataMember** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The data member of the data source to bind.               |
| **sourceProp** | [String](https://docs.microsoft.com/dotnet/api/system.string)                        | The property of the data source to display in the column. |

**Returns:** [TComponent](/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md). The ListView component with the data source bound to the specified column and data member.

This method binds a data source to a specified column in a ListView by setting the column's display property name, assigning the data member, and then assigning the data source to the ListView.

```csharp

var listView = new ListView();
var column = new ColumnHeader();
listView.Bind(column, dataSource, "DataMember", "SourceProperty");

```

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception) Thrown when the specified column is null.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web.markup/extensions/wisej.web.markup.bindingextensions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
