Skip to main content

DxComboBox<TData, TValue>.TextFieldName Property

Specifies the data source field that contains text for ComboBox items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public string TextFieldName { get; set; }

Property Value

Type Description
String

A string value that specifies a data source field’s name.

Remarks

Use the TextFieldName property when you bind the ComboBox to a data source that store custom objects (IEnumerable<CustomType>). This property specifies the name of the data source field that contains text for the ComboBox items.

If the TextFieldName property is not specified, the ComboBox component searches for a Text field in the data source and uses this field as a text field. Otherwise, ComboBox populates its items with the CustomType.ToString() values.

ComboBox CustomObject

@using BlazorApp.Data

<DxComboBox Data="@Staff.DataSource"
            @bind-Value="@SelectedPerson"
            TextFieldName="TextField"
            DropDownWidthMode="DropDownWidthMode.EditorWidth"
            AllowUserInput="true">
</DxComboBox>

@code {
    Person SelectedPerson { get; set; } = Staff.DataSource[0];
}

Run Demo: ComboBox - Overview

See Also