[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Collapse]Grid View Data Layout
    [Collapse]Columns and Card Fields
      Accessing and Identifying Columns
     [Collapse]Creating Columns and Binding Them to Data Properties
       Binding Columns to Data Source Fields
      Hiding and Displaying Columns and Bands
    [Expand]Bands
    [Expand]Rows and Cards
    [Expand]Nodes
     Data Cells
     Best Fit
     Compact Mode
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
   [Expand]Drag-and-Drop
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Binding Columns to Data Source Fields

You can use the ColumnBase.FieldName and ColumnBase.Binding properties to associate a grid column with a data source's property. This topic describes the difference between them.

Note

The ColumnBase.FieldName or ColumnBase.Binding properties should be defined for every GridControl column.

Expanded The FieldName Property

The FieldName has better performance than the Binding property because the GridControl obtains property values using PropertyDescriptor objects. However, the GridControl's columns have the following limitations:

  • A column cannot be used for Dynamic Object properties (binding to the ExpandoObject is supported).
  • A column cannot access collection members (like FieldName="SomeItems[0]").
  • Only objects of the same type in the ItemsSource collection are supported. PropertyDescriptor objects obtained from the collection type or the first data source item are internally cached and used for all data source items.
  • A column ignores a nested property's changes when the field name has a complex path (like "ClientClasses.Count").
  • Editing of collection properties is not supported.

Expanded The Binding Property

You can use the Binding property to avoid the FieldName property's limitations. In this case, the GridControl's columns have the following limitations:

Note

You cannot use the Binding and FieldName properties simultaneously if they refer to an existing data source property.

Expanded How the GridControl Identifies Columns

The GridControl identifies columns by their FieldName values. If you use Binding, the FieldName is set automatically and has the "RowData.Row.{Your binding path}" format. You can pass these values to the GridSortInfo constructor, specify them in summary items' FieldName, use them in conditional formatting rules, etc.

You can set the FieldName property to any unique value and use this value instead of "RowData.Row.{Binding Path}" as it is shown in the code sample below:

If you have multiple columns with the same binding path, set their FieldName to unique values to enable the GridControl to distinguish between columns:

Is this topic helpful?​​​​​​​