Skip to main content

GridControl.CustomUnboundColumnData Event

Allows you to populate unbound columns with data.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v22.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public event GridColumnDataEventHandler CustomUnboundColumnData

Event Data

The CustomUnboundColumnData event's data class is GridColumnDataEventArgs. The following properties provide information specific to this event:

Property Description
Column Gets the unbound column currently being processed.
IsGetData Gets whether you should provide data for the currently processed cell. Inherited from ColumnDataEventArgsBase.
IsSetData Gets whether a cell’s value should be saved to a data source. Inherited from ColumnDataEventArgsBase.
ListSourceRowIndex Gets the index of the record in a data source to which the processed row corresponds.
Source Gets the grid control that raised the event.
Value Gets or sets the processed cell’s value. Inherited from ColumnDataEventArgsBase.

The event data class exposes the following methods:

Method Description
GetListSourceFieldValue(Int32, String) Returns the value of the specified cell within the specified row in the grid’s data source.
GetListSourceFieldValue(String) Returns the value of the specified cell within the processed row in the grid’s data source.


Unbound Columns are not bound to any field in the data source. You can calculate unbound column values based on values of bound columns or populate unbound columns with data from a custom data source.

Handle the CustomUnboundColumnData event to populate unbound columns with data and save changes to a custom data source.

Display Unbound Data
The GridColumnDataEventArgs.IsGetData property returns true when the GridControl populates unbound columns with data. The GridColumnDataEventArgs.ListSourceRowIndex property returns the processed row’s index in a grid’s data source. Specify the GridColumnDataEventArgs.Value property to display data in the unbound column.
Save Changes
The GridColumnDataEventArgs.IsSetData property returns true when a user changes a cell value. The GridColumnDataEventArgs.Value property returns the modified cell value that you can save to a custom data source.

If you want to maintain a clean MVVM pattern and populate unbound columns with data in a View Model, create a command and bind it to the CustomUnboundColumnDataCommand property.


This example shows how to add an unbound column to the GridControl. This column should display the total price, calculated as follows: UnitPrice * UnitsOnOrder.

DevExpress WPF | Grid Control - Custom Unbound Data

View Example: How to Create Unbound Columns

<dxg:GridControl x:Name="grid"
    <dxg:GridColumn FieldName="CompanyName"/>
    <dxg:GridColumn FieldName="City"/>
    <dxg:GridColumn FieldName="UnitPrice">
            <dxe:TextEditSettings DisplayFormat="c2"/>
    <dxg:GridColumn FieldName="Quantity"/>
    <dxg:GridColumn FieldName="Total" UnboundDataType="{x:Type sys:Decimal}" ReadOnly="True">
            <dxe:TextEditSettings DisplayFormat="c2"/>
        <dxg:TableView AutoWidth="True"/>
void grid_CustomUnboundColumnData(object sender, GridColumnDataEventArgs e) {
    if(e.IsGetData) {
        int price = Convert.ToInt32(e.GetListSourceFieldValue(nameof(Product.UnitPrice)));
        int quantity = Convert.ToInt32(e.GetListSourceFieldValue(nameof(Product.Quantity)));
        e.Value = price * quantity;

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomUnboundColumnData event.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also