Back to Devexpress

ColumnBase.UnboundExpression Property

wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-72377bfd.md

latest4.1 KB
Original Source

ColumnBase.UnboundExpression Property

Gets or sets an expression used to evaluate values for this column if it is not bound to a data source field.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
[DefaultValue("")]
public string UnboundExpression { get; set; }
vb
<DefaultValue("")>
Public Property UnboundExpression As String

Property Value

TypeDefaultDescription
StringString.Empty

A String that specifies an expression used to evaluate values for this column.

|

Remarks

The GridControl supports bound and unbound columns:

  • Bound columns obtain their data from data fields in a grid’s data source.

  • Unbound columns are not bound to any field in the data source. These columns must be populated manually by handling the GridControl.CustomUnboundColumnData event or using the UnboundExpression property.

  • Xaml

xaml
<dxg:GridColumn FieldName="DiscountAmount"
                UnboundDataType="{x:Type sys:Decimal}"
                UnboundExpression="Round([UnitPrice] * [Quantity] - [Total])">
</dxg:GridColumn>

Tip

Topics :

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

Note

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.

wpf-data-grid-display-datetime-value-in-separate-date-and-time-columns/CS/DateAndTimeColumns_Unbound/MainWindow.xaml#L17

xml
<dxg:GridControl.Columns>
    <dxg:GridColumn FieldName="Date" Header="Date" UnboundType="DateTime" UnboundExpression="GetDate([DateTime])" AllowEditing="False"/>
    <dxg:GridColumn FieldName="Time" Header="Time" UnboundType="DateTime" UnboundExpression="AddTicks(Today(), GetTimeOfDay([DateTime]))" AllowEditing="False" RoundDateTimeForColumnFilter="False">

wpf-data-grid-export-data-to-native-excel-table/CS/WpfApplication80/MainWindow.xaml#L15

xml
<dxg:GridColumn FieldName="MaxValue"/>
<dxg:GridColumn FieldName="Average" UnboundType="Integer" UnboundExpression="([MinValue]+[MaxValue])/2"/>
<dxg:GridControl.View>

wpf-datagrid-round-decimal-values/CS/FilterDuplicateRecords_Unbound/MainWindow.xaml#L21

xml
UnboundType="Decimal"
UnboundExpression="Round([Growth], 2)"
ReadOnly="True"/>

See Also

ColumnBase Class

ColumnBase Members

DevExpress.Xpf.Grid Namespace