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
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:
- Range. Create the FixedDateTimePeriodLimit or FlowDateTimePeriodLimit class objects and assign them to the DateTimePeriod.Start and DateTimePeriod.End properties.
Note
If you do not specify DateTimePeriod.Start/DateTimePeriod.End, the selection will begin from the start/end of the visible range.
- Name (quick filter’s caption). Assign a string to the DateTimePeriod.Name property.
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