Skip to main content

DateFilterDashboardItem.DateTimePeriods Property

Gets a collection of date-time periods used as Quick Filters.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.1.Core.dll

NuGet Package: DevExpress.Dashboard.Core

Declaration

public DateTimePeriodCollection DateTimePeriods { get; }

Property Value

Type Description
DateTimePeriodCollection

A DateTimePeriodCollection object that is a collection of date-time periods.

Example

The following code snippet adds Quick Filters to the Date Filter dashboard item. It uses the DateTimePeriod static methods to create a predefined period. To create a custom period it creates the DateTimePeriod class instance and specify its settings as follows:

dateFilter.DateTimePeriods.AddRange(
    DateTimePeriod.CreateLastYear(),
    DateTimePeriod.CreateNextDays("Next 7 Days", 7),
    new DateTimePeriod
    {
        Name = DashboardWinLocalizer.GetString(DashboardWinStringId.PeriodMonthToDate),
        Start = new FlowDateTimePeriodLimit
        {
            Interval = DateTimeInterval.Month,
            Offset = 0
        },
        End = new FlowDateTimePeriodLimit
        {
            Interval = DateTimeInterval.Day,
            Offset = 1
        }
    },
    new DateTimePeriod
    {
        Name = "Jul-18-2018 - Jan-18-2019",
        Start = new FixedDateTimePeriodLimit
        {
            Date = new DateTime(2018, 7, 18)
        },
        End = new FixedDateTimePeriodLimit
        {
            Date = new DateTime(2019, 1, 18)
        }
    }
);
See Also