GridColumnDataEventArgs.RowData Property
Gets an object that contains information on the currently processed row.
Namespace: DevExpress.XamarinForms.DataGrid
Assembly: DevExpress.XamarinForms.Grid.dll
NuGet Package: DevExpress.XamarinForms.Grid
Declaration
public IRowData RowData { get; }
Property Value
Type | Description |
---|---|
IRowData | An object that implements the IRowData interface. |
Remarks
Use the IRowData object’s properties and methods to access required data values of the processed row when you handle the DataGridView.CustomUnboundColumnData event to supply data for an unbound column. The IRowData.RowHandle property returns the processed row handle. To obtain an object that represents a record in the grid’s underlying data source, use the IRowData.Item property. To get a value in the specified field, use the IRowData.GetFieldValue method.
If the DataGridView.CustomUnboundColumnData event is raised when an unbound column’s value is modified in the grid (GridColumnDataEventArgs.IsSetData is true), you can change any field’s value based on the modified value of the unbound column. To do this, use the IEditableRowData.SetFieldValue method of an object that the GridColumnDataEventArgs.EditableRowData property returns.
Example
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:
<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>
- Use the DataGridView.CustomUnboundColumnData event:
<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>