DxCheckBox<T>.CheckedExpression Property

Specifies a lambda expression that identifies the Checked property’s bound value when the CheckBox is placed in the EditForm.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

[Parameter]
public Expression<Func<T>> CheckedExpression { get; set; }

Property Value

Type Description
Expression<Func<T>>

A lambda expression that identifies the bound value.

Remarks

You can add the CheckBox to Blazor’s standard EditForm component to validate the Checked property value. In this case, the CheckedExpression property is used to obtain metadata about the value bound to the Checked property.

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

<DxCheckBox Checked="@Value"
            CheckedExpression="@(() => Value)"
            CheckedChanged="@((bool value) => CheckedChanged(value))">
</DxCheckBox>

@code {
    bool Value { get; set; }
    // ...
    void CheckedChanged(bool value) {
        // ...
    }
}

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

<DxCheckBox @bind-Checked="@Value">
</DxCheckBox>

@code {
    bool Value { get; set; }
    // ...
}

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

DevExpress.Blazor.DxCheckBox requires a value for the ‘CheckedExpression’ property. It is specified automatically when you use two-way binding (‘bind-Checked’).

See Also