Skip to main content

DxTimeEdit<T>.TimeExpression Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Property Value

Type Description
Expression<Func<T>>

A lambda expression that identifies the bound value.

Remarks

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

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

<DxTimeEdit Time="@TimeValue"
            TimeExpression="@(() => TimeValue)"
            TimeChanged="@((TimeSpan newValue) => TimeChanged(newValue))">
</DxTimeEdit>

@code {
    TimeSpan TimeValue { get; set; }
    // ...
    void TimeChanged(TimeSpan time) {
        // ...
    }
}

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

<DxTimeEdit @bind-Time="@TimeValue" ></DxTimeEdit>

@code {
    TimeSpan TimeValue { get; set; } = DateTime.Now.TimeOfDay;
}

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

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

See Also