Skip to main content

ComboBoxEdit.UseItemTemplateAsDisplayItemTemplate Property

Gets or sets whether to apply the ItemTemplate to the display item and drop-down list items.

Namespace: DevExpress.Maui.Editors

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

Declaration

public bool UseItemTemplateAsDisplayItemTemplate { get; set; }

Property Value

Type Description
Boolean

true to apply the ItemTemplate to the display item; false to use the DisplayItemTemplate.

Remarks

The following example shows how to use the same template for a ComboBoxEdit‘s display item and drop-down items:

The item template is used as the display item template

<dxe:ComboBoxEdit x:Name="comboBox" 
                  LabelText="Person" 
                  ItemsSource="{Binding}"
                  DisplayMember="Name" 
                  WidthRequest="400" 
                  HeightRequest="80"
                  UseItemTemplateAsDisplayItemTemplate="True">
    <dxe:ComboBoxEdit.ItemTemplate>
        <DataTemplate>
            <Grid ColumnDefinitions="*,*,*">
                <Label Padding="10" Text="{Binding Name}" FontAttributes="Bold" TextColor="Purple"/>
                <Label Padding="10" Grid.Column="1" Text="{Binding Age}" TextColor="Black"/>
                <Label Padding="10" Grid.Column="2" Text="{Binding Location}" TextColor="Gray"/>
            </Grid>
        </DataTemplate>
    </dxe:ComboBoxEdit.ItemTemplate>
</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; }
}
See Also