blazor-devexpress-dot-blazor-dot-dxcombobox-2-ab0b0e05.md
Allows you to react to the ComboBox editor’s text changes.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public EventCallback<string> TextChanged { get; set; }
| Type | Description |
|---|---|
| String |
The new text.
|
The ComboBox editor updates the Text property value and raises the TextChanged event when a user performs one of the following actions:
The following code snippet displays the current text and value of the ComboBox above the editor:
<p class="mb-1">
Selected item: <b>@(Value == null ? "null" : Value)</b>, Text = <b>@Text</b>
</p>
<DxComboBox Data="@Cities"
AllowUserInput="true"
@bind-Value="@Value"
Text="@Text"
TextChanged="@OnTextChanged" />
@code {
IEnumerable<string> Cities = new List<string>() { "London", "Berlin", "Paris", };
string Value { get; set; }
string Text { get; set; } = "London";
void OnTextChanged(string newValue) {
Text = newValue;
}
}
You can also use the TextChanging event to validate/cancel user input or item selection.
See Also
DxComboBox<TData, TValue> Class