Skip to main content

Unbound Columns

  • 3 minutes to read

#Bound and Unbound Columns

DXGrid for Silverlight 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 a data source. These columns must be populated manually by handling the GridControl.CustomUnboundColumnData event or using the ColumnBase.UnboundExpression property. The syntax for creating expressions is described in Expressions Overview.

An unbound column is one that meets the following two requirements.

  • The ColumnBase.FieldName property must be set to a unique value and cannot refer to any field in a grid's data source.
  • The ColumnBase.UnboundType property must be set to an appropriate value according to the type of data this column is supposed to display (Boolean, DateTime, Decimal, Integer, String or Object). This property also determines an unbound column's default editor, used to represent its values. For example, if it is set to Boolean, a CheckEdit will be used by default. To replace the default editor, use a column's ColumnBase.EditSettings property.

There is no difference between working with bound and unbound columns. You can sort, group, display summaries and filter unbound columns in the same manner as bound columns.

If unbound data is obtained from a custom data source, when adding a new row, add a new entry to the custom data source that corresponds to the new record in the grid. Similarly, when a record is deleted, delete the corresponding entry in the custom data source. To receive notifications that a record has been added or removed, use the methods provided by a data source.

NOTE

DXGrid for Silverlight cannot operate with only unbound columns. It must be bound to a data source using its DataControlBase.ItemsSource property.

#Unbound Column's Data

In most instances, data for unbound columns is obtained from a custom data source or is calculated based upon the values of bound columns.

To provide data for unbound columns and save any changes made back to a custom data source, handle the GridControl.CustomUnboundColumnData event. Note that this event is raised only for unbound columns.

Unbound data can be edited if it is retrieved from a custom data source. After an end-user has changed an unbound column's value, this value should then be saved back to a grid's data source. By default, data editing is enabled. To make an unbound column read-only, set its ColumnBase.ReadOnly property to true. You can also disable data editing by setting the ColumnBase.AllowEditing property to 'False'.

#Example: How to Display Unbound Data