The requested page is not available for the requested platform. You are viewing the content for Default platform.

GridColumnDataEventArgs Class

Provides data for the DataGridView.CustomUnboundColumnData event.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

Declaration

public class GridColumnDataEventArgs

Remarks

The DataGridView.CustomUnboundColumnData event allows you to populate unbound columns with data and save data values modified in unbound columns back to the data source. Use the IsGetData and IsSetData properties to determine whether the event handler should provide data for or save data from an unbound column.

The Column property returns the currently processed unbound column. To get the data of the processed row or assign a value to any field in this row, use the RowData or EditableRowData property.

Examples

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:

<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Orders}">
    <dxg:DataGridView.Columns>
        <dxg:TextColumn FieldName="Product.Name" Caption="Product" Width="170" />
        <dxg:NumberColumn FieldName="Product.UnitPrice" Caption="Price" DisplayFormat="C0"/>
        <dxg:NumberColumn FieldName="Quantity"/>
        <dxg:NumberColumn FieldName="Total" UnboundType="Integer"
                          UnboundExpression="[Quantity] * [Product.UnitPrice]" 
                          IsReadOnly="True" DisplayFormat="C0"/>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>
<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Orders}" CustomUnboundColumnData="Grid_CustomUnboundColumnData">
    <dxg:DataGridView.Columns>
        <dxg:TextColumn FieldName="Product.Name" Caption="Product" Width="170" />
        <dxg:NumberColumn FieldName="Product.UnitPrice" Caption="Price" DisplayFormat="C0"/>
        <dxg:NumberColumn FieldName="Quantity"/>
        <dxg:NumberColumn FieldName="Total" UnboundType="Integer"
                          IsReadOnly="True" DisplayFormat="C0"/>
    </dxg:DataGridView.Columns>
</dxg:DataGridView>

Inheritance

Object
GridColumnDataEventArgs
See Also