Skip to main content

LookUpEditBase.ItemTemplate Property

Gets or sets a template that defines the presentation of items contained within the dropdown list. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

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

#Declaration

[Browsable(false)]
public DataTemplate ItemTemplate { get; set; }

#Property Value

Type Description
DataTemplate

A DataTemplate object that represents the template which defines the presentation of items contained within the dropdown list.

#Remarks

To apply ItemTemplate to the selected item (displayed within the edit box), set the LookUpEditBase.ApplyItemTemplateToSelectedItem property to true and disable the ButtonEdit.IsTextEditable option.

NOTE

The ItemTemplate property cannot be used if combobox items are represented by the ComboBoxEditItem class.

#Examples

This example shows how to define templates used to present selected items, and items displayed within a popup window.

<dxe:ComboBoxEdit SelectedIndex="0"
                    Width="40" Height="20"
                    IsTextEditable="False"
                    ApplyItemTemplateToSelectedItem="True">
    <dxe:ComboBoxEdit.ItemTemplate>
        <DataTemplate>
            <Border Background="Transparent">
                <StackPanel Orientation="Horizontal">
                    <Rectangle Fill="{Binding}" Margin="6,0,6,0"
                                RadiusX="2" RadiusY="2"
                                Width="10" Height="10" />
                    <TextBlock Text="{Binding}" />
                </StackPanel>
            </Border>
        </DataTemplate>
    </dxe:ComboBoxEdit.ItemTemplate>
    <dxe:ComboBoxEdit.SelectedItemTemplate>
        <ControlTemplate>
            <Rectangle Margin="2" Fill="{Binding Path=SelectedItem}" />
        </ControlTemplate>
    </dxe:ComboBoxEdit.SelectedItemTemplate>
    <dxe:ComboBoxEdit.Items>
        <sys:String>Red</sys:String>
        <sys:String>Green</sys:String>
        <sys:String>Blue</sys:String>
    </dxe:ComboBoxEdit.Items>
</dxe:ComboBoxEdit>

#Implements

DevExpress.Xpf.Editors.Internal.ISelectorEdit.ItemTemplate
See Also