Skip to main content

LookUpEditBase.ApplyItemTemplateToSelectedItem Property

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

Namespace: DevExpress.Xpf.Editors

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

#Declaration

public bool ApplyItemTemplateToSelectedItem { get; set; }

#Property Value

Type Description
Boolean

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

#Remarks

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 LookUpEditBase.SelectedItemTemplate 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.

If the LookUpEditBase.SelectedItemTemplate property is specified, setting the ApplyItemTemplateToSelectedItem option has no effect.

NOTE

A custom template can be applied to the selected item if the ButtonEdit.IsTextEditable property is set to false.

NOTE

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:


<dxe:ComboBoxEdit.EditNonEditableTemplate>
                <ControlTemplate>
                    <Grid>
                        <Grid.Resources>
                            <dx:NullableToVisibilityConverter x:Key="c1"/>
                            <dx:NullableToVisibilityConverter x:Key="c" Invert="True"/>
                        </Grid.Resources>
                        <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" />
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </dxe:ComboBoxEdit.EditNonEditableTemplate>
See Also