Skip to main content

Customizing Unbound Grid

  • 2 minutes to read

The DXGrid provides design-time enhancements allowing you to automatically create columns for all fields in a data source to which the grid is bound at runtime. You should do the following:

Specify the Type of Data Objects

Specify the type of data objects using the DataControlBase.DesignTimeDataObjectType property. This property can be set in the following ways:

  • Namespace.TypeName,AssemblyName;
  • Namespace.TypeName (The first found assembly which contains the specified type, is used);
  • TypeName (The first found namespace which contains the specified type, is used).

Once this property is specified, if the DataControlBase.AutoPopulateColumns option is enabled, the gird renders sample columns for each public property in the specified type so that you can see how the grid will look like at runtime.

Populate Columns

To populate the GridControl.Columns collection, invoke the grid’s smart tag panel and click the Generate Columns item. The order of columns is the same as the order of public properties.


Customize Edit Settings

If a column’s editor isn’t specified, the grid automatically creates it at runtime, based on the type of column values. For instance, if a column is bound to a field that contains DateTime values, the grid creates a date editor for it. If a column is bound to a field that contains numeric or Boolean data, the numeric or check editor is used, respectively. Otherwise, the text editor is created.

To specify the type of a column’s editor, select the column, invoke its smart tag panel and modify the EditSettings property value.