DxComboBox<TData, TValue>.Text Property

Specifies the text displayed within the ComboBox edit box.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

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

Property Value

Type Description
String

The textual representation of the editor’s value.

Remarks

The Text property specifies the ComboBox edit box’s text. When you assign text to this property, you should also set the ComboBox’s AllowUserInput property to true.

To handle changes to the text, use the TextChanged event.

ComboBox Text

<DxComboBox Data="@Cities"
            TValue="string"
            TData="string"
            AllowUserInput="true"
            Text="@Text"
            TextChanged="@OnTextChanged">
</DxComboBox>

<DxButton Enabled="@IsEnabled">Update Text</DxButton>

@code {
    IEnumerable<string> Cities = new List<string>() {
        "London",
        "Berlin",
        "Paris",
    };

    string Text { get; set; } = "New York";
    bool IsEnabled = false;

    void OnTextChanged(string newValue) {
        Text = newValue;
        IsEnabled = newValue != "New York";
    }
}

If the value of the Text property is equal to a ComboBox drop-down window’s item, the corresponding item is automatically selected.

Run Demo: ComboBox - Allow Input

See Also