Back to Devexpress

DxCalendar<T>.SelectedDatesExpression Property

blazor-devexpress-dot-blazor-dot-dxcalendar-1-b4a8f44f.md

latest3.0 KB
Original Source

DxCalendar<T>.SelectedDatesExpression Property

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

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDescription
Expression<Func<IEnumerable<T>>>

A lambda expression that identifies the bound value.

|

Remarks

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

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

razor
<DxCalendar SelectedDates="@SelectedDates"
            SelectedDatesExpression="@(() => SelectedDates)"
            SelectedDatesChanged="@((IEnumerable<DateTime> newValue) => SelectedDatesChanged(newValue))">
</DxCalendar>

@code {
    List<DateTime> SelectedDates = new List<DateTime>();
    // ...
    void SelectedDatesChanged(IEnumerable<DateTime> selectedDates) {
        // ...
    }
}

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

razor
<DxCalendar @bind-SelectedDates="@SelectedDates">
</DxCalendar>

@code {
    List<DateTime> SelectedDates = new List<DateTime>();
    // ...
}

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

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

See Also

DxCalendar<T> Class

DxCalendar<T> Members

DevExpress.Blazor Namespace