Back to Devexpress

ColumnBase.EditFormTemplate Property

wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-f29d1130.md

latest3.7 KB
Original Source

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.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public DataTemplate EditFormTemplate { get; set; }
vb
Public Property EditFormTemplate As DataTemplate

Property Value

TypeDescription
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.

xaml
<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.

  • 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

Edit Entire Row

ColumnBase Class

ColumnBase Members

DevExpress.Xpf.Grid Namespace