Skip to main content

DxTextBox.TextExpression Property

Specifies a lambda expression that identifies the Text property’s bound value when a text editor is placed in the EditForm.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Expression<Func<string>> TextExpression { get; set; }

Property Value

Type Description
Expression<Func<String>>

A lambda expression that identifies the bound value.

Remarks

You can add a Text Box to Blazor’s standard EditForm component to validate the Text property value. In this case, the TextExpression property is used to obtain metadata about the value bound to the Text property.

You should specify the TextExpression property if you handle the TextChanged event and cannot use two-way binding.

<DxTextBox Text="@TextValue"
           TextExpression="@(() => TextValue)"
           TextChanged="@TextChanged">
</DxTextBox>

@code {
    string TextValue = "Some text";
    // ...
    void TextChanged(string textValue) {
        // ...
    }
}

The TextExpression property is set internally if you use the @bind attribute for the Text property to implement two-way binding.

<DxTextBox @bind-Text="@TextValue">
</DxTextBox>

@code {
    string TextValue = "Some text";
    // ...
}

The following exception occurs if you do not use two-way binding or the TextExpression property:

DevExpress.Blazor.DxTextBox and DevExpress.Blazor.DxMemo require a value for the ‘TextExpression’ property. It is specified automatically when you use two-way binding (‘bind-Text’).

See Also