wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-87ea721a.md
Gets or sets the type of data stored in the unbound column. This is a dependency property.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll
NuGet Package : DevExpress.Wpf.Grid.Core
[Browsable(false)]
[DefaultValue(typeof(void))]
public Type UnboundDataType { get; set; }
<DefaultValue(GetType())>
<Browsable(False)>
Public Property UnboundDataType As Type
| Type | Default | Description |
|---|---|---|
| Type | void |
The type of data stored in the unbound column.
|
If the UnboundDataType property is not set to an existing data type, the column is considered bound to a data source field.
Follow the steps below:
UnboundDataType property to the type of values the column should store. The GridControl chooses the column’s default editor based on this property value. To replace the editor, use the ColumnBase.EditSettings property.Specify an expression (ColumnBase.UnboundExpression) that calculates column values. The Expressions section describes supported syntax.
Handle the GridControl.CustomUnboundColumnData/TreeListView.CustomUnboundColumnData event to specify unbound column values.
<Window ...
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<dxg:GridControl x:Name="grid">
<!-- ... -->
<dxg:GridColumn FieldName="Total"
UnboundDataType="{x:Type sys:Decimal}"
UnboundExpression="[Quantity] * [UnitPrice]"/>
</dxg:GridControl>
grid.Columns.Add(new DevExpress.Xpf.Grid.GridColumn() {
FieldName = "Total",
UnboundDataType = typeof(decimal),
UnboundExpression = "[Quantity] * [UnitPrice]"
});
grid.Columns.Add(New DevExpress.Xpf.Grid.GridColumn() With {
.FieldName = "Total",
.UnboundDataType = GetType(Decimal),
.UnboundExpression = "[Quantity] * [UnitPrice]"
})
Refer to the following help topic for more information: Unbound Columns.
The following code snippets (auto-collected from DevExpress Examples) contain references to the UnboundDataType 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-create-unbound-columns/CS/DXGrid_UnboundColumns_CodeBehind/Window1.xaml#L18
<dxg:GridColumn FieldName="Quantity"/>
<dxg:GridColumn FieldName="Total" UnboundDataType="{x:Type sys:Decimal}" ReadOnly="True">
<dxg:GridColumn.EditSettings>
<dxg:GridColumn FieldName="Action" />
<dxg:GridColumn FieldName="IconUnbound" UnboundDataType="{x:Type sys:Object}" CellTemplate="{StaticResource IconCellTemplate}" />
</dxg:GridControl.Columns>
wpf-bind-gridcontrol-to-dynamic-data/CS/Unbound_Columns/MainWindow.xaml#L16
<DataTemplate>
<dxg:GridColumn FieldName="{Binding Path=(dxci:DependencyObjectExtensions.DataContext).FieldName, RelativeSource={RelativeSource Self}}" UnboundDataType="{Binding Path=(dxci:DependencyObjectExtensions.DataContext).UnboundDataType, RelativeSource={RelativeSource Self}}" />
</DataTemplate>
wpf-data-grid-change-background-color-for-modified-cells/CS/HighlightChangedCellBehavior.cs#L68
unboundColumn.FieldName = UnboundColumnPrefix + column.FieldName;
unboundColumn.UnboundDataType = typeof(bool);
unboundColumn.Visible = false;
wpf-data-grid-change-background-color-for-modified-cells/VB/HighlightChangedCellBehavior.vb#L92
unboundColumn.FieldName = HighlightModifiedCells.ChangedCellsHighlightBehavior.UnboundColumnPrefix & column.FieldName
unboundColumn.UnboundDataType = GetType(Boolean)
unboundColumn.Visible = False
See Also