Skip to main content
Tag

ColumnBase.EditTemplate Property

Gets or sets a template that displays a custom editor used to edit column values. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

[Browsable(false)]
public ControlTemplate EditTemplate { get; set; }

Property Value

Type Description
ControlTemplate

A ControlTemplate object that represents the template that displays a custom editor.

Remarks

Tip

Starting from v18.2, using the ColumnBase.CellEditTemplate is recommended.

If the Name property of a control used to display cell values is set to PART_Editor, the GridControl treats it as its inner control, i.e., fills it with values and enables search results highlighting.

The following code example shows how to use custom editors (ProgressBar and Slider) to display and edit the Units On Order column’s values.

<dxg:GridControl x:Name="grid" ItemsSource="{Binding Products}" 
                 CustomUnboundColumnData="grid_CustomUnboundColumnData">
    <dxg:GridControl.Columns>
        <!-- -->
        <dxg:GridColumn FieldName="UnitsOnOrder">
            <dxg:GridColumn.DisplayTemplate>
                <ControlTemplate>
                    <ProgressBar Minimum="0" Maximum="50"
                                 Value="{Binding Path=DisplayText, Mode=OneWay, 
                                                 RelativeSource={RelativeSource TemplatedParent}}"/>
                </ControlTemplate>
            </dxg:GridColumn.DisplayTemplate>
            <dxg:GridColumn.EditTemplate>
                <ControlTemplate>
                    <Grid VerticalAlignment="Center">
                        <Slider Name="PART_Editor" Minimum="0" Maximum="50" 
                                Value="{Binding Path=EditValue, Mode=TwoWay, 
                                                RelativeSource={RelativeSource TemplatedParent}, 
                                                Converter={local:IntToDoubleConverter}}" />
                        <TextBlock Text="{Binding EditValue, RelativeSource={RelativeSource TemplatedParent}}" 
                                   Foreground="Black" VerticalAlignment="Center" 
                                   HorizontalAlignment="Center" TextWrapping="NoWrap" />
                    </Grid>
                </ControlTemplate>  
            </dxg:GridColumn.EditTemplate>
        </dxg:GridColumn>
    </dxg:GridControl.Columns>
    <dxg:GridControl.View>
        <dxg:TableView AutoWidth="True" />
    </dxg:GridControl.View>
</dxg:GridControl> 

Note

Using BaseEdit descendants is not recommended.

The following code snippets (auto-collected from DevExpress Examples) contain references to the EditTemplate property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also