ComboBoxEdit.DisplayItemTemplate Property
Gets or sets the data template that specifies the appearance of the item in the edit box. This is a bindable property.
Namespace: DevExpress.Maui.Editors
Assembly: DevExpress.Maui.Editors.dll
NuGet Package: DevExpress.Maui.Editors
Declaration
public DataTemplate DisplayItemTemplate { get; set; }
Property Value
Type | Description |
---|---|
DataTemplate | A template that configures appearance settings for the editor’s display item. |
Remarks
The following example configures the ComboBox’ display item appearance:
<dxe:ComboBoxEdit x:Name="comboBox"
LabelText="Person"
ItemsSource="{Binding}"
DisplayMember="Name"
WidthRequest="400" >
<dxe:ComboBoxEdit.DisplayItemTemplate>
<DataTemplate>
<Border StrokeThickness="2" BackgroundColor="#D5DCFD" Stroke="#8D9FFA">
<Border.StrokeShape>
<RoundRectangle CornerRadius="4" />
</Border.StrokeShape>
<Label Text="{Binding Name}" FontAttributes="Bold" TextColor="Gray"/>
</Border>
</DataTemplate>
</dxe:ComboBoxEdit.DisplayItemTemplate>
</dxe:ComboBoxEdit>
public MainPage() {
InitializeComponent();
this.BindingContext = new List<Person>() {
new Person {Name = "Devin", Age = 50, Location = "Atlanta"},
new Person {Name = "Brenda", Age = 25, Location = "Memphis"},
new Person {Name = "Sean", Age = 36, Location = "Houston"}
};
}
public class Person {
public string Name { get; set; }
public int Age { get; set; }
public string Location { get; set; }
}
If you want to apply the drop-down list item’s template (the ItemTemplate property) to the display item, set the UseItemTemplateAsDisplayItemTemplate property to true
. If you set both the ItemTemplate
and DisplayItemTemplate
properties and enable the UseItemTemplateAsDisplayItemTemplate
property, the DisplayItemTemplate
property has a higher priority.
For more information on how to customize the editor’s appearance, refer to the following section: ComboBoxEdit - Editor Appearance.