Skip to main content

DxComboBox<TData, TValue>.DisplayFormat Property

Specifies the pattern used to format the ComboBox’s display value when the editor is not focused.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor


public string DisplayFormat { get; set; }

Property Value

Type Default Description
String String.Empty

The format pattern.


Use the DisplayFormat property to format the ComboBox’s display value when the editor is not focused.

Refer to the following topic for more information about supported format strings: Format strings and .NET types.


To format the ComboBox’s edit value when the editor is focused, use the EditFormat property.

The DisplayFormat property allows you to format values in one-column and multi-column ComboBoxes.

Format a One-Column ComboBox

The following example demonstrates how to apply the currency format to numeric values.

<DxComboBox Data="@Prices" @bind-Value="@CurrentPrice" DisplayFormat="C"></DxComboBox>

@code {
    IEnumerable<string> Prices = new List<string>() {

    string CurrentPrice { get; set; }

ComboBox DisplayFormat

Format a Multi-Column ComboBox

The code below adds three columns to a ComboBox and applies the {1} {2} format to the component’s display values. This format specifies that the editor value includes values of the following columns: FirstName (VisibleIndex = 1) and LastName (VisibleIndex = 2).

<DxComboBox Data="@Staff.DataSource"
            EditFormat="{1} {2}"
            DisplayFormat="Selected user: {1} {2}">
        <DxListEditorColumn FieldName="Id" Width="50px" />
        <DxListEditorColumn FieldName="FirstName" />
        <DxListEditorColumn FieldName="LastName" />

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

ComboBox - Multi-Column Display Format

Run Demo: ComboBox – Multiple Columns

Watch Video: ComboBox - Multiple Columns and Cascade Lists

Format ComboBox Bound to a Custom-Type Collection

If you bind the ComboBox to a custom-type collection, you set the TextFieldName property. This property specifies the custom object’s field name that returns strings for the ComboBox’s drop-down window. The DisplayFormat is applied to these field values.

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. In these cases, the DisplayFormat is applied to these values.

<DxComboBox Data="@Data"

@code {
    public class Model {
        public DateTime DateTimeValue { get; set; }
        public int ID { get; set; }

    int CurrentID { get; set; }
    List<Model> Data;

    protected override void OnInitialized() {
        Data = new() {
            new() { DateTimeValue = DateTime.Today.AddDays(-1), ID = 0 },
            new() { DateTimeValue = DateTime.Today, ID = 1 },
            new() { DateTimeValue = DateTime.Today.AddDays(1), ID = 2 },
            new() { DateTimeValue = DateTime.Today.AddDays(2), ID = 3 }

ComboBox DisplayFormat - Custom Type

See Also