Skip to main content
A newer version of this page is available. .

DashboardDesigner.RangeFilterPredefinedDateTimePeriods Event

Allows you to customize the list of predefined periods in the Edit Periods dialog for the Range Filter dashboard item.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v19.1.Win.dll

Declaration

public event RangeFilterPredefinedDateTimePeriodsEventHandler RangeFilterPredefinedDateTimePeriods

Event Data

The RangeFilterPredefinedDateTimePeriods event's data class is RangeFilterPredefinedDateTimePeriodsEventArgs. The following properties provide information specific to this event:

Property Description
FilterType Gets the filter type specified in the Edit Periods dialog.
ItemComponentName Gets the component name of the dashboard item for which the event was raised.
Periods Provides access to a collection of predefined periods displayed in the Edit Periods dialog.

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