Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Data Binding
   [Collapse]Views
    [Collapse]Grid View
      Columns
      Unbound Columns
      Rows
      Cells
     Banded Grid Views
    [Expand]Card and Layout Views
     WinExplorer View
    [Expand]Tile View
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Unbound Columns

Unbound columns are grid columns that display custom data or data calculated from other columns' values.

Expanded Foreword

Unbound columns and regular bound columns are objects of the same classes: the GridColumn, BandedGridColumn or LayoutViewColumn class. This means unbound columns fully support all column features - sorting, grouping, filtering, summaries, etc.

However, the Data Grid cannot operate without a data source, requiring you to assign one even if you only need unbound columns. For example, utilize the UnboundSource component to tell the Data Grid how many rows it should generate.

Expanded Create Unbound Columns

To add unbound columns, invoke the Data Grid Designer's "Columns" tab and click the "Add Column" button. In the property grid, set up two properties:

  • GridColumn.FieldName - must be set to a unique value that does not match any data source field name;
  • GridColumn.UnboundType - change this property's value to the type of data your column should display. Columns automatically use in-place editors that correspond to this type of data.

If you add unbound columns in code, remember to explicitly set their visibility.

Expanded Unbound Expressions

Unbound expressions allow you to calculate values of unbound columns based on other column values. Expressions are built in the Expression Editor dialog. To invoke this dialog, click the ellipsis button next to the GridColumn.UnboundExpression property in the VS Property Grid.

In code, expressions are assigned as simple strings. For instance, the code below calculates the year by subtracting values of the grid column with the "Int" field name from the current year.

Tip

Unbound columns that utilize expressions remain editable, although since cell values are calculated according to an expression, edits made by end-users are automatically discarded. It is recommended that you disable the OptionsColumn.AllowEdit setting for such columns.

Demo: Unbound Expressions

Expanded Modify Unbound Expressions at Runtime

Your end-users can right-click an unbound column's header and select "Expression Editor..." to modify the expression. You may choose whether end-users work with a legacy Editor (same one you use at design time), or its updated version that supports syntax highlighting and auto-completion.

Related API

Demo: Unbound Expressions

Expanded Editable Unbound Columns with Custom Data

Handle the ColumnView.CustomUnboundColumnData event to supply unbound columns with completely unique data, rather than data calculated by expressions. This also allows such columns to remain editable. Event arguments provide two parameters for distinguishing between retrieving and editing data.

The Unbound Columns Code Example illustrates how to retrieve data from a Dictionary and save changes back to it.

Expanded See Also

How would you rate this topic?​​​​​​​