Skip to main content

LookUpEditBase.ApplyItemTemplateToSelectedItem Property

Gets or sets whether to apply the ItemTemplate to the selected item, displayed within the edit box. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

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

NuGet Package: DevExpress.Wpf.Core


public bool ApplyItemTemplateToSelectedItem { get; set; }

Property Value

Type Description

true to apply the item template to the selected item; otherwise, false.


There are two properties that allow you to change the visual presentation of the selected item (displayed within the edit box) and items displayed within the dropdown list. These are the BaseEdit.EditTemplate and LookUpEditBase.ItemTemplate properties, respectively. In some instances (e.g., creating an image combobox), it is required to use one template to present the selected item and items displayed within the dropdown list. To do this, set the ApplyItemTemplateToSelectedItem property to true.

The item template is applied only if the combobox’s ButtonEdit.IsTextEditable property is set to false.


Using the ApplyItemTemplateToSelectedItem property overrides the editor’s default template and disables the BaseEdit.NullText property (if specified). To specify the text displayed within the edit box when the editor’s value is null, use the TextEditBase.EditNonEditableTemplate property:

                            <dx:NullableToVisibilityConverter x:Key="c1"/>
                            <dx:NullableToVisibilityConverter x:Key="c" Invert="True"/>
                        <TextBlock Text="Select a Color" Visibility="{Binding EditValue, Converter={StaticResource c}}"/>
                        <StackPanel Orientation="Horizontal" Margin="3" Visibility="{Binding EditValue, Converter={StaticResource c1}}">
                            <Rectangle Width="16" Height="16" Margin="3" Fill="{Binding EditValue}" />
                            <TextBlock Text="{Binding EditValue.Color}" Margin="3" />


The following example shows how to create an image combobox via templates.

View Example

<Window xmlns=""
        Title="Creating an Image ComboBox"
        Height="300" Width="300">
            <ColumnDefinition />
            <ColumnDefinition Width="100" />
            <ColumnDefinition />
            <RowDefinition />
            <RowDefinition Height="22" />
            <RowDefinition />
        <dxe:ComboBoxEdit ApplyItemTemplateToSelectedItem="True" IsTextEditable="False"
                          Text="(None)" Grid.Row="1" Grid.Column="1" Padding="5,2,5,2">
                    <Border Background="Transparent">
                        <StackPanel Orientation="Horizontal">
                            <Rectangle Width="10" Height="10" Fill="{Binding}"
                                       RadiusX="2" RadiusY="2"
                                       Margin="6,0,6,0" />
                            <TextBlock Text="{Binding}" />

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


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