Skip to main content
A newer version of this page is available.

GridColumnDataEventArgs.Source Property

Gets the grid that raised the event.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

Declaration

public DataGridView Source { get; }

Property Value

Type Description
DataGridView

A DataGridView object that raised the event.

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:

<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>
See Also