Back to Devexpress

DxDateRangePicker<T>.MaxDate Property

blazor-devexpress-dot-blazor-dot-dxdaterangepicker-1-c9c99bf7.md

latest1.8 KB
Original Source

DxDateRangePicker<T>.MaxDate Property

Specifies the maximum date that can be selected in the Date Range Picker.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public DateTime MaxDate { get; set; }

Property Value

TypeDescription
DateTime

A DateTime value that specifies the maximum date.

|

Remarks

You can use the MinDate and MaxDate properties to limit the available date range.

razor
<DxDateRangePicker @bind-StartDate="@DateTimeStart"
                   @bind-EndDate="@DateTimeEnd"
                   MinDate="@MinDate"
                   MaxDate="@MaxDate"/>

@code {
    DateTime DateTimeStart { get; set; } = DateTime.Today;
    DateTime DateTimeEnd { get; set; } = DateTime.Today.AddDays(7);
    DateTime MinDate { get; set; }
    DateTime MaxDate { get; set; }
    protected override void OnInitialized() {
        MinDate = DateTimeStart.AddDays(-7);
        int days = DateTime.DaysInMonth(DateTimeStart.Year, DateTimeStart.Month);
        MaxDate = new DateTime(DateTimeStart.Year, DateTimeStart.Month, days).AddDays(14);
    }
}

Run Demo: Range of Available Dates

See Also

DxDateRangePicker<T> Class

DxDateRangePicker<T> Members

DevExpress.Blazor Namespace