Skip to main content
A newer version of this page is available. .

Assign an Editor to a Cell

  • 2 minutes to read

The GridControl provides the following approaches to assign editors to column cells:

Approach

Affects Sorting / Filtering / Grouping

Supports Printing / Exporting

Supports Standard WPF Controls

Provides a Template Selector

Works in Edit Mode

EditSettings

yes

yes

no

no

yes

CellTemplate

no

no

yes

yes

yes

CellDisplayTemplate

no

no

yes

yes

no

CellEditTemplate

no

no

yes

yes

yes

If you specify the CellDisplayTemplate, CellEditTemplate, and CellTemplate for a single column, only the CellDisplayTemplate and CellEditTemplate is applied. If you specify the CellTemplate and EditSettings for a single column, only the CellTemplate is applied.

Performance depends on the current cell editor. The difference is not noticeable when you use lightweight controls (for example, TextBlock). When you use heavier controls, the EditSettings property allows you to gain maximum performance.

EditSettings

The EditSettings property allows you to assign the BaseEditSettings descendants that correspond to DevExpress Data Editors. The Assign Editors to Columns topic lists all helper classes responsible for the editor’s functionality.

xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
...
<dxg:GridColumn FieldName="ColumnFieldName">
    <dxg:GridColumn.EditSettings>
        <dxe:ButtonEditSettings/>
    </dxg:GridColumn.EditSettings>
</dxg:GridColumn>

CellTemplate

The CellTemplate property allows you to specify DevExpress WPF Controls and Standard WPF Controls.

xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
...
<dxg:GridColumn FieldName="ColumnFieldName">
    <dxg:GridColumn.CellTemplate>
        <DataTemplate>
            <dxe:ButtonEdit Name="PART_Editor"/>
        </DataTemplate>
    </dxg:GridColumn.CellTemplate>
</dxg:GridColumn> 

CellDisplayTemplate and CellEditTemplate

The CellDisplayTemplate and CellEditTemplate allow you to specify separate controls to display and edit data.

CellDisplayTemplate

xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
...
<dxg:GridColumn FieldName="ColumnFieldName">
    <dxg:GridColumn.CellDisplayTemplate>
        <DataTemplate>
            <dxe:ButtonEdit x:Name="PART_Editor"/>
        </DataTemplate>
    </dxg:GridColumn.CellDisplayTemplate>
</dxg:GridColumn> 

CellEditTemplate

xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
...
<dxg:GridColumn FieldName="ColumnFieldName">
   <dxg:GridColumn.CellEditTemplate>
       <DataTemplate>
           <dxe:ButtonEdit x:Name="PART_Editor"/>
      </DataTemplate>
   </dxg:GridColumn.CellEditTemplate>
</dxg:GridColumn> 
See Also