maui-devexpress-dot-maui-dot-datagrid-dot-datagridview-4f37ec58.md
Enables you to populate unbound columns with data, and save changes that users made in unbound columns.
Namespace : DevExpress.Maui.DataGrid
Assembly : DevExpress.Maui.DataGrid.dll
NuGet Package : DevExpress.Maui.DataGrid
public event EventHandler<CustomUnboundDataEventArgs> CustomUnboundData
The CustomUnboundData event's data class is CustomUnboundDataEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Column | Returns the processed unbound column. |
| IsGetData | Indicates that you should supply 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 | Returns an object that is a record in the grid’s underlying data source. |
| SourceIndex | Returns the grid’s row index in the data source. |
| 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 CustomUnboundData event. This event fires in two cases:
CustomUnboundData event with the IsGetData parameter set to true (consequently the IsSetData parameter is set to false ). In this case, you can supply data for the currently processed cell. Assign the required value to the Value parameter.CustomUnboundData event is fired with the IsSetData parameter set to true (consequently IsGetData is set to false ). In this case, you can save the modified data value that the Value parameter returns.Note
The grid raises the CustomUnboundData 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.CustomUnboundData event:
See Also