BaseEdit.EditTemplate Property

Gets or sets a template that defines the editor's presentation in edit mode. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v20.1.dll

Declaration

[Browsable(false)]
public ControlTemplate EditTemplate { get; set; }
<Browsable(False)>
Public Property EditTemplate As ControlTemplate

Property Value

Type Description
ControlTemplate

A ControlTemplate object representing the editor's template.

Remarks

Standalone Editor

A standalone editor is always in edit mode. Setting the BaseEdit.DisplayTemplate property has no effect. To customize the editor's presentation, use the EditTemplate property.

In-Place Editor

If the editor is used inplace within a container control (e.g. the grid), its mode depends on whether its owning cell is edited. If a cell is edited, its editor is in edit inplace mode. Otherwise, it is in display mode.

To customize the editor's presentation, create the corresponding templates (display and/or edit template) and assign them to the BaseEdit.DisplayTemplate and BaseEdit.EditTemplate properties.

To learn more on inplace editors, see Inplace Editors.

A template that represents the editor's border can be specified using the BaseEdit.BorderTemplate property.

Examples

The following example shows how to customize the visual appearance of a standalone editor.

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="BaseEdit_CustomizingAppearance.Window1"
        Title="Window1" Height="300" Width="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="130" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="32" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <dxe:TextEdit BorderThickness="0" EditValue="USA" ShowBorder="False"
                      Grid.Column="1" Grid.Row="1">
            <dxe:TextEdit.EditTemplate>
                <ControlTemplate>
                    <Border CornerRadius="7" BorderBrush="Orange" BorderThickness="3">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Margin="2" VerticalAlignment="Center"
                                       Foreground="Gray" Text="Country:" />
                            <TextBox Text="{Binding EditValue, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </dxe:TextEdit.EditTemplate>
        </dxe:TextEdit>
    </Grid>
</Window>

Implements

DevExpress.Xpf.Editors.IBaseEdit.EditTemplate
See Also