mobilecontrols-devexpress-dot-xamarinforms-dot-datagrid-dot-datagridview-b378c8b4.md
Enables you to populate unbound columns with data, and save changes that users made in unbound columns.
Namespace : DevExpress.XamarinForms.DataGrid
Assembly : DevExpress.XamarinForms.Grid.dll
NuGet Package : DevExpress.XamarinForms.Grid
public event GridColumnDataEventHandler CustomUnboundColumnData
The CustomUnboundColumnData event's data class is GridColumnDataEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Column | Gets the currently processed unbound column. |
| IsGetData | Indicates that you should provide data for the current cell of the unbound column in the event handler. |
| IsSetData | Indicates that you should save the current value of the unbound column’s cell to a data source in the event handler. |
| Item | Gets an object that represents a record in the grid’s underlying data source. |
| RowHandle | Gets the grid’s row handle. |
| Value | Gets or sets a value of the unbound column’s cell. |
DataGridView allows you to create unbound (calculated) columns. These columns are not bound to any field in the underlying data source. To provide data for these columns, use the GridColumn.UnboundExpression property or handle the CustomUnboundColumnData event. This event fires in two cases:
You can identify the currently processed cell by the column (Column) and row (RowHandle).
Note
The grid raises the CustomUnboundColumnData event only for columns with both the FieldName and UnboundType properties specified.
Assume that the DataGridView instance is bound to a collection of orders. An order has the Product.Name, Product.UnitPrice and Quantity fields. This example shows how to add an unbound column (Total) to the grid to calculate each order amount according to the expression: UnitPrice*Quantity.
Implement logic to calculate column values in one of the following ways:
Use the GridColumn.UnboundExpression property:
Handle the DataGridView.CustomUnboundColumnData event:
See Also