Skip to main content

RangeFilterPredefinedDateTimePeriodsEventArgs.Periods Property

Provides access to a collection of predefined periods displayed in the Edit Periods dialog.

Namespace: DevExpress.DashboardCommon

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

Declaration

public IList<DateTimePeriod> Periods { get; }

Property Value

Type Description
IList<DateTimePeriod>

A collection of DateTimePeriod objects that specify predefined date-time periods.

Example

This example shows how to use the DashboardDesigner.RangeFilterPredefinedDateTimePeriods event to customize a default list of predefined periods from the Edit Periods dialog. Note that this list is customized when filtering by year is applied in the dialog.

    using DevExpress.DashboardCommon;        
      //...           
    private void dashboardDesigner_RangeFilterPredefinedDateTimePeriods(object sender, RangeFilterPredefinedDateTimePeriodsEventArgs e) {
            if (e.ItemComponentName == "range" && e.FilterType == DateTimePeriodFilterType.Year) {
                // Creates a new 'Last 4 Years' period.
                FlowDateTimePeriodLimit startDate = new FlowDateTimePeriodLimit(DateTimeInterval.Year, -4);
                FlowDateTimePeriodLimit endDate = new FlowDateTimePeriodLimit(DateTimeInterval.Year, 0);
                DateTimePeriod period = new DateTimePeriod("Last 4 Years", startDate, endDate);
                e.Periods.Insert(3, period);

                // Removes the default 'Last Year' period.
                period = e.Periods.FirstOrDefault(p => p.Name == DashboardWinLocalizer.GetString(DashboardWinStringId.PeriodLastYear));
                e.Periods.Remove(period);
            }
        }
See Also