Skip to main content
Tag

ColumnBase.EditFormTemplate Property

Gets or sets a template of the editor associated with the current column in the edit form.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v23.2.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public DataTemplate EditFormTemplate { get; set; }

Property Value

Type Description
DataTemplate

The template that defines the appearance of a data editor.

Remarks

The template specified by the EditFormTemplate property is applied to the editor displayed in the edit form.

The EditFormEditor objects defined in the TableView.EditFormTemplate use the EditFormTemplate to display the column’s editor.

Specify Custom Editors

You can use the EditFormTemplate property to specify a custom editor for the column:

  • Add a BaseEdit descendant editor.
  • Set the editor’s Name property to PART_Editor.

The following example demonstrates a GridControl that displays the inline edit form. The SpinEdit editor is used for the Quantity field.

Data Grid - Column EditFormTemplate Example

<dxg:GridControl ItemsSource="{Binding Source}">
    <dxg:GridControl.View>
        <dxg:TableView EditFormShowMode="Inline"/>
    </dxg:GridControl.View>
    <!-- ... -->
    <dxg:GridColumn FieldName="Quantity">
        <dxg:GridColumn.EditFormTemplate>
            <DataTemplate>
                <dxe:SpinEdit Name="PART_Editor" IsFloatValue="False"/>
            </DataTemplate>
        </dxg:GridColumn.EditFormTemplate>
    </dxg:GridColumn>
</dxg:GridControl>

Data Binding

The template’s data context is a DevExpress.Xpf.Grid.EditForm.EditFormCellData object. Use the following binding paths to access cell values, columns, and ViewModel properties:

  • Value - Access the current cell value.
  • EditorViewInfo - Access the current column.
  • RowData.Source.Row.[YourPropertyName] - Access a property of an object from the ItemsSource collection.

    This property is updated when a user clicks the Edit Form‘s Update button. The following help topic describes how to update the Edit Form‘s editor based on another editor’s value: Process Editor Value Changes.

  • RowData.Source.DataContext.[FieldName] - Access unbound column values.
  • RowData.Source.View.DataContext.[YourPropertyName] - Access a property in a grid’s ViewModel.

Refer to the following help topic for more information: Edit Form.

See Also