A newer version of this page is available. Switch to the current version.

GridColumn.UnboundType Property

Specifies whether this column is unbound and, if yes, the type of data it stores.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v19.2.dll


public UnboundColumnType UnboundType { get; set; }
Public Property UnboundType As UnboundColumnType

Property Value

Type Default Description


A UnboundColumnType enumeration value that specifies the data type and binding mode of the column.


If the UnboundType property equals Bound, the column displays values stored in a related data source field. Otherwise, the column is unbound and displays custom values. To create an unbound column in code, do the following.

  • Create a new GridColumn object and add it to the ColumnView.Columns collection.
  • Set the UnboundType property according to the data type this column should display. For instance, use the UnboundColumnType.Integer value if a column cells should display integer values.
  • Assign any value to the column GridColumn.FieldName. A field name must be unique and match neither other columns' field names, nor names of data source fields.

To populate an unbound column with values, do one of the following.

  • If you need to display values calculated from other columns' values, assign the required expression to the GridColumn.UnboundExpression property. Note that since cell values are calculated automatically, users cannot edit them. For the expression syntax, refer to the Expressions article.

  • To display custom values, handle the ColumnView.CustomUnboundColumnData event. Columns populated in this way remain editable.

See Unbound Columns for more info.


Assume that the Grid Control is bound to a table that contains the "Quantity", "UnitPrice" and "Discount" columns. The example below shows how to add an unbound column to the grid to display the amount of each order according to the expression: QuantityUnitPrice(1-Discount).

The result is displayed below:


For another example which illustrates working with unbound columns, see the Unbound Columns tutorial.

using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Columns;

private void Form1_Load(object sender, System.EventArgs e) {
   // ...

   // Create an unbound column.
   GridColumn unbColumn = gridView1.Columns.AddField("Total");
   unbColumn.VisibleIndex = gridView1.Columns.Count;
   unbColumn.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;
   // Disable editing.
   unbColumn.OptionsColumn.AllowEdit = false;
   // Specify format settings.
   unbColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
   unbColumn.DisplayFormat.FormatString = "c";
   // Customize the appearance settings.
   unbColumn.AppearanceCell.BackColor = Color.LemonChiffon;

// Returns the total amount for a specific row.
decimal getTotalValue(GridView view, int listSourceRowIndex) {
    decimal unitPrice = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "UnitPrice"));
    decimal quantity = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "Quantity"));
    decimal discount = Convert.ToDecimal(view.GetListSourceRowCellValue(listSourceRowIndex, "Discount"));
    return unitPrice * quantity * (1 - discount);

// Provides data for the Total column.
private void gridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e) {
   GridView view = sender as GridView;
   if (e.Column.FieldName == "Total" && e.IsGetData) e.Value = 
     getTotalValue(view, e.ListSourceRowIndex);
See Also