Back to Devexpress

DxDateEdit<T>.DateExpression Property

blazor-devexpress-dot-blazor-dot-dxdateedit-1-e9125152.md

latest2.7 KB
Original Source

DxDateEdit<T>.DateExpression Property

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

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDescription
Expression<Func<T>>

A lambda expression that identifies the bound value.

|

Remarks

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

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

razor
<DxDateEdit Date="@DateTimeValue"
            DateExpression="@(() => DateTimeValue)"
            DateChanged="@((DateTime newValue) => DateChanged(newValue))">
</DxDateEdit>

@code {
    DateTime DateTimeValue { get; set; }
    // ...
    void DateChanged(DateTime date) {
        // ...
    }
}

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

razor
<DxDateEdit @bind-Date="@DateTimeValue">
</DxDateEdit>

@code {
    DateTime DateTimeValue { get; set; }
    // ...
}

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

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

See Also

DxDateEdit<T> Class

DxDateEdit<T> Members

DevExpress.Blazor Namespace